@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | */ |
42 | 42 | |
43 | -if ( function_exists( 'espresso_version' ) ) { |
|
43 | +if (function_exists('espresso_version')) { |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * espresso_duplicate_plugin_error |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | function espresso_duplicate_plugin_error() { |
50 | 50 | ?> |
51 | 51 | <div class="error"> |
52 | - <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> |
|
52 | + <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> |
|
53 | 53 | </div> |
54 | 54 | <?php |
55 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
55 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
56 | 56 | } |
57 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
57 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
58 | 58 | |
59 | 59 | } else { |
60 | 60 | |
@@ -69,98 +69,98 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // define versions |
72 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
73 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.0' ); |
|
74 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.1' ); |
|
75 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
76 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
77 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
78 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
72 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
73 | + define('EE_MIN_WP_VER_REQUIRED', '4.0'); |
|
74 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.1'); |
|
75 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
76 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
77 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
78 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
79 | 79 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
80 | - if ( ! defined( 'DS' ) ) { |
|
81 | - define( 'DS', '/' ); |
|
80 | + if ( ! defined('DS')) { |
|
81 | + define('DS', '/'); |
|
82 | 82 | } |
83 | - if ( ! defined( 'PS' ) ) { |
|
84 | - define( 'PS', PATH_SEPARATOR ); |
|
83 | + if ( ! defined('PS')) { |
|
84 | + define('PS', PATH_SEPARATOR); |
|
85 | 85 | } |
86 | - if ( ! defined( 'SP' ) ) { |
|
87 | - define( 'SP', ' ' ); |
|
86 | + if ( ! defined('SP')) { |
|
87 | + define('SP', ' '); |
|
88 | 88 | } |
89 | - if ( ! defined( 'EENL' ) ) { |
|
90 | - define( 'EENL', "\n" ); |
|
89 | + if ( ! defined('EENL')) { |
|
90 | + define('EENL', "\n"); |
|
91 | 91 | } |
92 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
92 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
93 | 93 | // define the plugin directory and URL |
94 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
94 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
95 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | 97 | // main root folder paths |
98 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
99 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
100 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
101 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
102 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
103 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
104 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
105 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
98 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
99 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
100 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
101 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
102 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
103 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
104 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
105 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
106 | 106 | // core system paths |
107 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
108 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
109 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
110 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
111 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
112 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
113 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
114 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
115 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
116 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
117 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
118 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
107 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
108 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
109 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
110 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
111 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
112 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
113 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
114 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
115 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
116 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
117 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
118 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
119 | 119 | // gateways |
120 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
121 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
120 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
121 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
122 | 122 | // asset URL paths |
123 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
124 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
125 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
126 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
127 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
128 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
123 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
124 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
125 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
126 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
127 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
128 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
129 | 129 | // define upload paths |
130 | 130 | $uploads = wp_upload_dir(); |
131 | 131 | // define the uploads directory and URL |
132 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
133 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
132 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
134 | 134 | // define the templates directory and URL |
135 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
135 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
137 | 137 | // define the gateway directory and URL |
138 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
138 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | 140 | // languages folder/path |
141 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
142 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
141 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
142 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
143 | 143 | //check for dompdf fonts in uploads |
144 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
145 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
144 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
145 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
146 | 146 | } |
147 | 147 | //ajax constants |
148 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
149 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
148 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
149 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
150 | 150 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
151 | 151 | //you're better to use this than its straight value (currently -1) in case you ever |
152 | 152 | //want to change its default value! or find when -1 means infinity |
153 | - define( 'EE_INF_IN_DB', -1 ); |
|
154 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
153 | + define('EE_INF_IN_DB', -1); |
|
154 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * espresso_plugin_activation |
158 | 158 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
159 | 159 | */ |
160 | 160 | function espresso_plugin_activation() { |
161 | - update_option( 'ee_espresso_activation', true ); |
|
161 | + update_option('ee_espresso_activation', true); |
|
162 | 162 | } |
163 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
163 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // } |
175 | 175 | // |
176 | 176 | } |
177 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
177 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
178 | 178 | |
179 | 179 | |
180 | 180 | |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | */ |
185 | 185 | function espresso_load_error_handling() { |
186 | 186 | // load debugging tools |
187 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
188 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
187 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
188 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
189 | 189 | EEH_Debug_Tools::instance(); |
190 | 190 | } |
191 | 191 | // load error handling |
192 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
193 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
192 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
193 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
194 | 194 | } else { |
195 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
195 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -206,25 +206,25 @@ discard block |
||
206 | 206 | * @param string $full_path_to_file |
207 | 207 | * @throws EE_Error |
208 | 208 | */ |
209 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
209 | + function espresso_load_required($classname, $full_path_to_file) { |
|
210 | 210 | static $error_handling_loaded = false; |
211 | - if ( ! $error_handling_loaded ) { |
|
211 | + if ( ! $error_handling_loaded) { |
|
212 | 212 | espresso_load_error_handling(); |
213 | 213 | $error_handling_loaded = true; |
214 | 214 | } |
215 | - if ( is_readable( $full_path_to_file ) ) { |
|
216 | - require_once( $full_path_to_file ); |
|
215 | + if (is_readable($full_path_to_file)) { |
|
216 | + require_once($full_path_to_file); |
|
217 | 217 | } else { |
218 | - throw new EE_Error ( sprintf( |
|
219 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
218 | + throw new EE_Error(sprintf( |
|
219 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
220 | 220 | $classname |
221 | - ) ); |
|
221 | + )); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
226 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
227 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
225 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
226 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
227 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
228 | 228 | new EE_Bootstrap(); |
229 | 229 | |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | |
235 | 235 | |
236 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
236 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
237 | 237 | /** |
238 | 238 | * deactivate_plugin |
239 | 239 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
243 | 243 | * @return void |
244 | 244 | */ |
245 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
246 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
247 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
245 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
246 | + if ( ! function_exists('deactivate_plugins')) { |
|
247 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
248 | 248 | } |
249 | - unset( $_GET[ 'activate' ] ); |
|
250 | - unset( $_REQUEST[ 'activate' ] ); |
|
251 | - deactivate_plugins( $plugin_basename ); |
|
249 | + unset($_GET['activate']); |
|
250 | + unset($_REQUEST['activate']); |
|
251 | + deactivate_plugins($plugin_basename); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 |
@@ -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 EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
38 | 38 | $this->_gateway = new EEG_AIM(); |
39 | 39 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
40 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
40 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
41 | 41 | $this->_requires_https = true; |
42 | 42 | parent::__construct($pm_instance); |
43 | 43 | } |
@@ -47,60 +47,60 @@ discard block |
||
47 | 47 | * @param \EE_Transaction $transaction |
48 | 48 | * @return EE_Billing_Info_Form |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | 89 | $required_inputs = array_merge( |
90 | 90 | array( |
91 | 91 | 'credit_card', |
92 | 92 | 'exp_month', |
93 | 93 | 'exp_year' ), |
94 | - $settings_form->get_input( 'required_billing_inputs' )->normalized_value() ); |
|
95 | - foreach( $billing_form->inputs() as $input_name => $input ) { |
|
96 | - if( in_array( $input_name, $required_inputs ) ) { |
|
97 | - $input->set_required( true ); |
|
94 | + $settings_form->get_input('required_billing_inputs')->normalized_value() ); |
|
95 | + foreach ($billing_form->inputs() as $input_name => $input) { |
|
96 | + if (in_array($input_name, $required_inputs)) { |
|
97 | + $input->set_required(true); |
|
98 | 98 | } else { |
99 | - $input->set_required( false ); |
|
99 | + $input->set_required(false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
103 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | * @param \EE_Billing_Info_Form $billing_form |
113 | 113 | * @return \EE_Billing_Info_Form |
114 | 114 | */ |
115 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
116 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
117 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
118 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
119 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
120 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
115 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
116 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
117 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
118 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
119 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
120 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
121 | 121 | } |
122 | 122 | $billing_form->add_subsections( |
123 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
123 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
124 | 124 | 'credit_card' |
125 | 125 | ); |
126 | 126 | $billing_form->add_subsections( |
127 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
127 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
128 | 128 | 'first_name' |
129 | 129 | ); |
130 | 130 | } |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | 'extra_meta_inputs'=>array( |
145 | 145 | 'login_id'=>new EE_Text_Input( |
146 | 146 | array( |
147 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
147 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
148 | 148 | 'required' => true ) |
149 | 149 | ), |
150 | 150 | 'transaction_key'=>new EE_Text_Input( |
151 | 151 | array( |
152 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
152 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
153 | 153 | 'required' => true ) |
154 | 154 | ), |
155 | 155 | 'test_transactions'=>new EE_Yes_No_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
158 | 158 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
159 | 159 | 'default' => false, |
160 | 160 | 'required' => true |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
164 | 164 | $billing_input_names, |
165 | 165 | array( |
166 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'default' => array( |
168 | 168 | 'company', |
169 | 169 | 'fax', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array_diff( |
177 | - array_keys( $billing_input_names ), |
|
178 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
177 | + array_keys($billing_input_names), |
|
178 | + array('address2', 'phone', 'company', 'fax') |
|
179 | 179 | ), |
180 | 180 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
181 | 181 | )), |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function billing_input_names() { |
193 | 193 | return array( |
194 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
194 | + 'first_name' => __('First Name', 'event_espresso'), |
|
195 | 195 | 'last_name' => __('Last Name', 'event_espresso'), |
196 | - 'email' => __( 'Email', 'event_espresso' ), |
|
197 | - 'company' => __( 'Company', 'event_espresso' ), |
|
196 | + 'email' => __('Email', 'event_espresso'), |
|
197 | + 'company' => __('Company', 'event_espresso'), |
|
198 | 198 | 'address' => __('Address', 'event_espresso'), |
199 | 199 | 'address2' => __('Address2', 'event_espresso'), |
200 | 200 | 'city' => __('City', 'event_espresso'), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'country' => __('Country', 'event_espresso'), |
203 | 203 | 'zip' => __('Zip', 'event_espresso'), |
204 | 204 | 'phone' => __('Phone', 'event_espresso'), |
205 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
205 | + 'fax' => __('Fax', 'event_espresso'), |
|
206 | 206 | 'cvv' => __('CVV', 'event_espresso') |
207 | 207 | ); |
208 | 208 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * @param type $billing_form |
214 | 214 | * @return array |
215 | 215 | */ |
216 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
216 | + protected function _get_billing_values_from_form($billing_form) { |
|
217 | 217 | $all_billing_values_empty = array(); |
218 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
219 | - $all_billing_values_empty[ $input_name ] = ''; |
|
218 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
219 | + $all_billing_values_empty[$input_name] = ''; |
|
220 | 220 | } |
221 | 221 | return array_merge( |
222 | 222 | $all_billing_values_empty, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see EE_PMT_Base::help_tabs_config() |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function help_tabs_config(){ |
|
234 | + public function help_tabs_config() { |
|
235 | 235 | return array( |
236 | 236 | $this->get_help_tab_name() => array( |
237 | 237 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -24,14 +24,14 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | static $initialized = false; |
27 | - if ( ! $initialized ) { |
|
27 | + if ( ! $initialized) { |
|
28 | 28 | // instantiate PSR4 autoloader |
29 | - espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' ); |
|
29 | + espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php'); |
|
30 | 30 | EE_Psr4AutoloaderInit::$psr4_loader = new \EventEspresso\Core\Psr4Autoloader(); |
31 | 31 | // register the autoloader |
32 | 32 | EE_Psr4AutoloaderInit::$psr4_loader->register(); |
33 | 33 | // register the base directories for the namespace prefix |
34 | - EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspresso', EE_PLUGIN_DIR_PATH ); |
|
34 | + EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH); |
|
35 | 35 | $initialized = true; |
36 | 36 | } |
37 | 37 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * date_format and the second value is the time format |
75 | 75 | * @return EE_Datetime |
76 | 76 | */ |
77 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
78 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
79 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
77 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
78 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
79 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * the website will be used. |
88 | 88 | * @return EE_Datetime |
89 | 89 | */ |
90 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
91 | - return new self( $props_n_values, TRUE, $timezone ); |
|
90 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
91 | + return new self($props_n_values, TRUE, $timezone); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * @param $name |
98 | 98 | */ |
99 | - public function set_name( $name ) { |
|
100 | - $this->set( 'DTT_name', $name ); |
|
99 | + public function set_name($name) { |
|
100 | + $this->set('DTT_name', $name); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * @param $description |
107 | 107 | */ |
108 | - public function set_description( $description ) { |
|
109 | - $this->set( 'DTT_description', $description ); |
|
108 | + public function set_description($description) { |
|
109 | + $this->set('DTT_description', $description); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @access public |
120 | 120 | * @param string $date a string representation of the event's date ex: Dec. 25, 2025 or 12-25-2025 |
121 | 121 | */ |
122 | - public function set_start_date( $date ) { |
|
123 | - $this->_set_date_for( $date, 'DTT_EVT_start' ); |
|
122 | + public function set_start_date($date) { |
|
123 | + $this->_set_date_for($date, 'DTT_EVT_start'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @access public |
134 | 134 | * @param string $time a string representation of the event time ex: 9am or 7:30 PM |
135 | 135 | */ |
136 | - public function set_start_time( $time ) { |
|
137 | - $this->_set_time_for( $time, 'DTT_EVT_start' ); |
|
136 | + public function set_start_time($time) { |
|
137 | + $this->_set_time_for($time, 'DTT_EVT_start'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @access public |
148 | 148 | * @param string $date a string representation of the event's date ex: Dec. 25, 2025 or 12-25-2025 |
149 | 149 | */ |
150 | - public function set_end_date( $date ) { |
|
151 | - $this->_set_date_for( $date, 'DTT_EVT_end' ); |
|
150 | + public function set_end_date($date) { |
|
151 | + $this->_set_date_for($date, 'DTT_EVT_end'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * @access public |
162 | 162 | * @param string $time a string representation of the event time ex: 9am or 7:30 PM |
163 | 163 | */ |
164 | - public function set_end_time( $time ) { |
|
165 | - $this->_set_time_for( $time, 'DTT_EVT_end' ); |
|
164 | + public function set_end_time($time) { |
|
165 | + $this->_set_time_for($time, 'DTT_EVT_end'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @access public |
176 | 176 | * @param int $reg_limit |
177 | 177 | */ |
178 | - public function set_reg_limit( $reg_limit ) { |
|
179 | - $this->set( 'DTT_reg_limit', $reg_limit ); |
|
178 | + public function set_reg_limit($reg_limit) { |
|
179 | + $this->set('DTT_reg_limit', $reg_limit); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | * @access public |
188 | 188 | * @param int $sold |
189 | 189 | */ |
190 | - public function set_sold( $sold ) { |
|
190 | + public function set_sold($sold) { |
|
191 | 191 | // sold can not go below zero |
192 | - $sold = max( 0, $sold ); |
|
193 | - $this->set( 'DTT_sold', $sold ); |
|
192 | + $sold = max(0, $sold); |
|
193 | + $this->set('DTT_sold', $sold); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | * increments sold by amount passed by $qty |
200 | 200 | * @param int $qty |
201 | 201 | */ |
202 | - function increase_sold( $qty = 1 ) { |
|
202 | + function increase_sold($qty = 1) { |
|
203 | 203 | $sold = $this->sold() + $qty; |
204 | - $this->set_sold( $sold ); |
|
204 | + $this->set_sold($sold); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * decrements (subtracts) sold amount passed by $qty |
211 | 211 | * @param int $qty |
212 | 212 | */ |
213 | - function decrease_sold( $qty = 1 ) { |
|
213 | + function decrease_sold($qty = 1) { |
|
214 | 214 | $sold = $this->sold() - $qty; |
215 | - $this->set_sold( $sold ); |
|
215 | + $this->set_sold($sold); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return string |
223 | 223 | */ |
224 | 224 | public function name() { |
225 | - return $this->get( 'DTT_name' ); |
|
225 | + return $this->get('DTT_name'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return string |
233 | 233 | */ |
234 | 234 | public function description() { |
235 | - return $this->get( 'DTT_description' ); |
|
235 | + return $this->get('DTT_description'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @return boolean TRUE if is primary, FALSE if not. |
243 | 243 | */ |
244 | 244 | public function is_primary() { |
245 | - return $this->get( 'DTT_is_primary' ); |
|
245 | + return $this->get('DTT_is_primary'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @return int The order of the datetime for this event. |
253 | 253 | */ |
254 | 254 | public function order() { |
255 | - return $this->get( 'DTT_order' ); |
|
255 | + return $this->get('DTT_order'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return int |
263 | 263 | */ |
264 | 264 | public function parent() { |
265 | - return $this->get( 'DTT_parent' ); |
|
265 | + return $this->get('DTT_parent'); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | * @param bool $echo - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats) |
279 | 279 | * @return string|bool|void string on success, FALSE on fail |
280 | 280 | */ |
281 | - private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) { |
|
281 | + private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) { |
|
282 | 282 | $field_name = "DTT_EVT_{$start_or_end}"; |
283 | - $dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo ); |
|
284 | - if ( ! $echo ) { |
|
283 | + $dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo); |
|
284 | + if ( ! $echo) { |
|
285 | 285 | return $dtt; |
286 | 286 | } |
287 | 287 | return ''; |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param null $dt_frmt - string representation of date format defaults to 'F j, Y' |
298 | 298 | * @return mixed string on success, FALSE on fail |
299 | 299 | */ |
300 | - public function start_date( $dt_frmt = NULL ) { |
|
301 | - return $this->_show_datetime( 'D', 'start', $dt_frmt ); |
|
300 | + public function start_date($dt_frmt = NULL) { |
|
301 | + return $this->_show_datetime('D', 'start', $dt_frmt); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | * Echoes start_date() |
308 | 308 | * @param string $dt_frmt |
309 | 309 | */ |
310 | - public function e_start_date( $dt_frmt = NULL ) { |
|
311 | - $this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE ); |
|
310 | + public function e_start_date($dt_frmt = NULL) { |
|
311 | + $this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | * @param null $dt_frmt - string representation of date format defaults to 'F j, Y' |
322 | 322 | * @return mixed string on success, FALSE on fail |
323 | 323 | */ |
324 | - public function end_date( $dt_frmt = NULL ) { |
|
325 | - return $this->_show_datetime( 'D', 'end', $dt_frmt ); |
|
324 | + public function end_date($dt_frmt = NULL) { |
|
325 | + return $this->_show_datetime('D', 'end', $dt_frmt); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | * Echoes the end date. See end_date() |
332 | 332 | * @param string $dt_frmt |
333 | 333 | */ |
334 | - public function e_end_date( $dt_frmt = NULL ) { |
|
335 | - $this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE ); |
|
334 | + public function e_end_date($dt_frmt = NULL) { |
|
335 | + $this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
346 | 346 | * @return mixed string on success, FALSE on fail |
347 | 347 | */ |
348 | - public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) { |
|
349 | - $dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt; |
|
350 | - $start = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) ); |
|
351 | - $end = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) ); |
|
352 | - return $start != $end ? $start . $conjunction . $end : $start; |
|
348 | + public function date_range($dt_frmt = NULL, $conjunction = ' - ') { |
|
349 | + $dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt; |
|
350 | + $start = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt)); |
|
351 | + $end = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt)); |
|
352 | + return $start != $end ? $start.$conjunction.$end : $start; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | * @param null $dt_frmt |
359 | 359 | * @param string $conjunction |
360 | 360 | */ |
361 | - public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) { |
|
362 | - echo $this->date_range( $dt_frmt, $conjunction ); |
|
361 | + public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') { |
|
362 | + echo $this->date_range($dt_frmt, $conjunction); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param string $tm_format - string representation of time format defaults to 'g:i a' |
372 | 372 | * @return mixed string on success, FALSE on fail |
373 | 373 | */ |
374 | - public function start_time( $tm_format = NULL ) { |
|
375 | - return $this->_show_datetime( 'T', 'start', NULL, $tm_format ); |
|
374 | + public function start_time($tm_format = NULL) { |
|
375 | + return $this->_show_datetime('T', 'start', NULL, $tm_format); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * @param null $tm_format |
382 | 382 | */ |
383 | - public function e_start_time( $tm_format = NULL ) { |
|
384 | - $this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE ); |
|
383 | + public function e_start_time($tm_format = NULL) { |
|
384 | + $this->_show_datetime('T', 'start', NULL, $tm_format, TRUE); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param string $tm_format - string representation of time format defaults to 'g:i a' |
394 | 394 | * @return mixed string on success, FALSE on fail |
395 | 395 | */ |
396 | - public function end_time( $tm_format = NULL ) { |
|
397 | - return $this->_show_datetime( 'T', 'end', NULL, $tm_format ); |
|
396 | + public function end_time($tm_format = NULL) { |
|
397 | + return $this->_show_datetime('T', 'end', NULL, $tm_format); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | /** |
403 | 403 | * @param null $tm_format |
404 | 404 | */ |
405 | - public function e_end_time( $tm_format = NULL ) { |
|
406 | - $this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE ); |
|
405 | + public function e_end_time($tm_format = NULL) { |
|
406 | + $this->_show_datetime('T', 'end', NULL, $tm_format, TRUE); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
417 | 417 | * @return mixed string on success, FALSE on fail |
418 | 418 | */ |
419 | - public function time_range( $tm_format = NULL, $conjunction = ' - ' ) { |
|
420 | - $tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt; |
|
419 | + public function time_range($tm_format = NULL, $conjunction = ' - ') { |
|
420 | + $tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt; |
|
421 | 421 | |
422 | - $start = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) ); |
|
423 | - $end = str_replace( ' ', ' ', $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format ) ); |
|
424 | - return $start != $end ? $start . $conjunction . $end : $start; |
|
422 | + $start = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_start', $tm_format)); |
|
423 | + $end = str_replace(' ', ' ', $this->get_i18n_datetime('DTT_EVT_end', $tm_format)); |
|
424 | + return $start != $end ? $start.$conjunction.$end : $start; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @param null $tm_format |
431 | 431 | * @param string $conjunction |
432 | 432 | */ |
433 | - public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) { |
|
434 | - echo $this->time_range( $tm_format, $conjunction ); |
|
433 | + public function e_time_range($tm_format = NULL, $conjunction = ' - ') { |
|
434 | + echo $this->time_range($tm_format, $conjunction); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | * @param string $tm_format - string representation of time format defaults to 'g:i a' |
445 | 445 | * @return mixed string on success, FALSE on fail |
446 | 446 | */ |
447 | - public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) { |
|
448 | - return $this->_show_datetime( '', 'start', $dt_format, $tm_format ); |
|
447 | + public function start_date_and_time($dt_format = NULL, $tm_format = NULL) { |
|
448 | + return $this->_show_datetime('', 'start', $dt_format, $tm_format); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | * @param null $dt_frmt |
455 | 455 | * @param null $tm_format |
456 | 456 | */ |
457 | - public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) { |
|
458 | - $this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE ); |
|
457 | + public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) { |
|
458 | + $this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param bool $round_up |
470 | 470 | * @return float|int|mixed |
471 | 471 | */ |
472 | - public function length( $units = 'seconds', $round_up = FALSE ) { |
|
473 | - $start = $this->get_raw( 'DTT_EVT_start' ); |
|
474 | - $end = $this->get_raw( 'DTT_EVT_end' ); |
|
472 | + public function length($units = 'seconds', $round_up = FALSE) { |
|
473 | + $start = $this->get_raw('DTT_EVT_start'); |
|
474 | + $end = $this->get_raw('DTT_EVT_end'); |
|
475 | 475 | $length_in_units = $end - $start; |
476 | - switch ( $units ) { |
|
476 | + switch ($units) { |
|
477 | 477 | //NOTE: We purposefully don't use "break;" in order to chain the divisions |
478 | 478 | /** @noinspection PhpMissingBreakStatementInspection */ |
479 | 479 | case 'days': |
@@ -486,10 +486,10 @@ discard block |
||
486 | 486 | $length_in_units /= 60; |
487 | 487 | case 'seconds': |
488 | 488 | default: |
489 | - $length_in_units = ceil( $length_in_units ); |
|
489 | + $length_in_units = ceil($length_in_units); |
|
490 | 490 | } |
491 | - if ( $round_up ) { |
|
492 | - $length_in_units = max( $length_in_units, 1 ); |
|
491 | + if ($round_up) { |
|
492 | + $length_in_units = max($length_in_units, 1); |
|
493 | 493 | } |
494 | 494 | return $length_in_units; |
495 | 495 | } |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * @param bool | string $tm_format - string representation of time format defaults to 'g:i a' |
505 | 505 | * @return mixed string on success, FALSE on fail |
506 | 506 | */ |
507 | - public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) { |
|
508 | - return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format ); |
|
507 | + public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) { |
|
508 | + return $this->_show_datetime('', 'end', $dt_frmt, $tm_format); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | * @param bool $dt_frmt |
515 | 515 | * @param bool $tm_format |
516 | 516 | */ |
517 | - public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) { |
|
518 | - $this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE ); |
|
517 | + public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) { |
|
518 | + $this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return int |
528 | 528 | */ |
529 | 529 | public function start() { |
530 | - return $this->get_raw( 'DTT_EVT_start' ); |
|
530 | + return $this->get_raw('DTT_EVT_start'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @return int |
540 | 540 | */ |
541 | 541 | public function end() { |
542 | - return $this->get_raw( 'DTT_EVT_end' ); |
|
542 | + return $this->get_raw('DTT_EVT_end'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * @return mixed int on success, FALSE on fail |
552 | 552 | */ |
553 | 553 | public function reg_limit() { |
554 | - return $this->get_raw( 'DTT_reg_limit' ); |
|
554 | + return $this->get_raw('DTT_reg_limit'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @return mixed int on success, FALSE on fail |
564 | 564 | */ |
565 | 565 | public function sold() { |
566 | - return $this->get_raw( 'DTT_sold' ); |
|
566 | + return $this->get_raw('DTT_sold'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | |
@@ -592,15 +592,15 @@ discard block |
||
592 | 592 | * the spaces remaining for this particular datetime, hence the flag. |
593 | 593 | * @return int |
594 | 594 | */ |
595 | - public function spaces_remaining( $consider_tickets = FALSE ) { |
|
595 | + public function spaces_remaining($consider_tickets = FALSE) { |
|
596 | 596 | // tickets remaining available for purchase |
597 | 597 | //no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF |
598 | 598 | $dtt_remaining = $this->reg_limit() - $this->sold(); |
599 | - if ( ! $consider_tickets ) { |
|
599 | + if ( ! $consider_tickets) { |
|
600 | 600 | return $dtt_remaining; |
601 | 601 | } |
602 | 602 | $tickets_remaining = $this->tickets_remaining(); |
603 | - return min( $dtt_remaining, $tickets_remaining ); |
|
603 | + return min($dtt_remaining, $tickets_remaining); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
@@ -611,19 +611,19 @@ discard block |
||
611 | 611 | * @param array $query_params like EEM_Base::get_all's |
612 | 612 | * @return int |
613 | 613 | */ |
614 | - public function tickets_remaining( $query_params = array() ) { |
|
614 | + public function tickets_remaining($query_params = array()) { |
|
615 | 615 | $sum = 0; |
616 | - $tickets = $this->tickets( $query_params ); |
|
617 | - if ( ! empty( $tickets ) ) { |
|
618 | - foreach ( $tickets as $ticket ) { |
|
619 | - if ( $ticket instanceof EE_Ticket ) { |
|
616 | + $tickets = $this->tickets($query_params); |
|
617 | + if ( ! empty($tickets)) { |
|
618 | + foreach ($tickets as $ticket) { |
|
619 | + if ($ticket instanceof EE_Ticket) { |
|
620 | 620 | // get the actual amount of tickets that can be sold |
621 | - $qty = $ticket->qty( 'saleable' ); |
|
622 | - if ( $qty === EE_INF ) { |
|
621 | + $qty = $ticket->qty('saleable'); |
|
622 | + if ($qty === EE_INF) { |
|
623 | 623 | return EE_INF; |
624 | 624 | } |
625 | 625 | // no negative ticket quantities plz |
626 | - if ( $qty > 0 ) { |
|
626 | + if ($qty > 0) { |
|
627 | 627 | $sum += $qty; |
628 | 628 | } |
629 | 629 | } |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | * @param array $query_params like EEM_Base::get_all's |
641 | 641 | * @return int |
642 | 642 | */ |
643 | - public function sum_tickets_initially_available( $query_params = array() ) { |
|
644 | - return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' ); |
|
643 | + public function sum_tickets_initially_available($query_params = array()) { |
|
644 | + return $this->sum_related('Ticket', $query_params, 'TKT_qty'); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * @return int |
654 | 654 | */ |
655 | 655 | public function total_tickets_available_at_this_datetime() { |
656 | - return $this->spaces_remaining( true ); |
|
656 | + return $this->spaces_remaining(true); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * @return boolean |
665 | 665 | */ |
666 | 666 | public function is_upcoming() { |
667 | - return ( $this->get_raw( 'DTT_EVT_start' ) > time() ); |
|
667 | + return ($this->get_raw('DTT_EVT_start') > time()); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @return boolean |
675 | 675 | */ |
676 | 676 | public function is_active() { |
677 | - return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() ); |
|
677 | + return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time()); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @return boolean |
685 | 685 | */ |
686 | 686 | public function is_expired() { |
687 | - return ( $this->get_raw( 'DTT_EVT_end' ) < time() ); |
|
687 | + return ($this->get_raw('DTT_EVT_end') < time()); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -695,16 +695,16 @@ discard block |
||
695 | 695 | */ |
696 | 696 | public function get_active_status() { |
697 | 697 | $total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime(); |
698 | - if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) { |
|
698 | + if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) { |
|
699 | 699 | return EE_Datetime::sold_out; |
700 | 700 | } |
701 | - if ( $this->is_expired() ) { |
|
701 | + if ($this->is_expired()) { |
|
702 | 702 | return EE_Datetime::expired; |
703 | 703 | } |
704 | - if ( $this->is_upcoming() ) { |
|
704 | + if ($this->is_upcoming()) { |
|
705 | 705 | return EE_Datetime::upcoming; |
706 | 706 | } |
707 | - if ( $this->is_active() ) { |
|
707 | + if ($this->is_active()) { |
|
708 | 708 | return EE_Datetime::active; |
709 | 709 | } |
710 | 710 | return NULL; |
@@ -718,24 +718,24 @@ discard block |
||
718 | 718 | * @param boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty. |
719 | 719 | * @return string |
720 | 720 | */ |
721 | - public function get_dtt_display_name( $use_dtt_name = FALSE ) { |
|
722 | - if ( $use_dtt_name ) { |
|
721 | + public function get_dtt_display_name($use_dtt_name = FALSE) { |
|
722 | + if ($use_dtt_name) { |
|
723 | 723 | $dtt_name = $this->name(); |
724 | - if ( !empty( $dtt_name ) ) { |
|
724 | + if ( ! empty($dtt_name)) { |
|
725 | 725 | return $dtt_name; |
726 | 726 | } |
727 | 727 | } |
728 | 728 | //first condition is to see if the months are different |
729 | - if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) { |
|
730 | - $display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' ); |
|
729 | + if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) { |
|
730 | + $display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a'); |
|
731 | 731 | //next condition is if its the same month but different day |
732 | 732 | } |
733 | 733 | else { |
734 | - if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) { |
|
735 | - $display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' ); |
|
734 | + if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) { |
|
735 | + $display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y'); |
|
736 | 736 | } |
737 | 737 | else { |
738 | - $display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' ); |
|
738 | + $display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a'); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | return $display_date; |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | *@param array $query_params see EEM_Base::get_all() |
750 | 750 | * @return EE_Ticket[] |
751 | 751 | */ |
752 | - public function tickets( $query_params = array() ) { |
|
753 | - return $this->get_many_related( 'Ticket', $query_params ); |
|
752 | + public function tickets($query_params = array()) { |
|
753 | + return $this->get_many_related('Ticket', $query_params); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | |
@@ -760,21 +760,21 @@ discard block |
||
760 | 760 | * @param array $query_params like EEM_Base::get_all's |
761 | 761 | * @return EE_Ticket[] |
762 | 762 | */ |
763 | - public function ticket_types_available_for_purchase( $query_params = array() ) { |
|
763 | + public function ticket_types_available_for_purchase($query_params = array()) { |
|
764 | 764 | // first check if datetime is valid |
765 | - if ( !( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) { |
|
765 | + if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) { |
|
766 | 766 | return array(); |
767 | 767 | } |
768 | - if ( empty( $query_params ) ) { |
|
768 | + if (empty($query_params)) { |
|
769 | 769 | $query_params = array( |
770 | 770 | array( |
771 | - 'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ), |
|
772 | - 'TKT_end_date' => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ), |
|
771 | + 'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')), |
|
772 | + 'TKT_end_date' => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')), |
|
773 | 773 | 'TKT_deleted' => false |
774 | 774 | ) |
775 | 775 | ); |
776 | 776 | } |
777 | - return $this->tickets( $query_params ); |
|
777 | + return $this->tickets($query_params); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | * @return EE_Event |
785 | 785 | */ |
786 | 786 | public function event() { |
787 | - return $this->get_first_related( 'Event' ); |
|
787 | + return $this->get_first_related('Event'); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | |
@@ -796,13 +796,13 @@ discard block |
||
796 | 796 | */ |
797 | 797 | public function update_sold() { |
798 | 798 | $count_regs_for_this_datetime = EEM_Registration::instance()->count( |
799 | - array( array( |
|
799 | + array(array( |
|
800 | 800 | 'STS_ID' => EEM_Registration::status_id_approved, |
801 | 801 | 'REG_deleted' => 0, |
802 | 802 | 'Ticket.Datetime.DTT_ID' => $this->ID(), |
803 | - ) ) |
|
803 | + )) |
|
804 | 804 | ); |
805 | - $this->set( 'DTT_sold', $count_regs_for_this_datetime ); |
|
805 | + $this->set('DTT_sold', $count_regs_for_this_datetime); |
|
806 | 806 | $this->save(); |
807 | 807 | return $count_regs_for_this_datetime; |
808 | 808 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * date_format and the second value is the time format |
67 | 67 | * @return EE_Ticket |
68 | 68 | */ |
69 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
70 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
71 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
69 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
70 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
71 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * the website will be used. |
80 | 80 | * @return EE_Ticket |
81 | 81 | */ |
82 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
83 | - return new self( $props_n_values, TRUE, $timezone ); |
|
82 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
83 | + return new self($props_n_values, TRUE, $timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return bool |
90 | 90 | */ |
91 | 91 | public function parent() { |
92 | - return $this->get( 'TKT_parent' ); |
|
92 | + return $this->get('TKT_parent'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param int $DTT_ID the primary key for a particular datetime |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function available( $DTT_ID = 0 ) { |
|
102 | + public function available($DTT_ID = 0) { |
|
103 | 103 | // are we checking availability for a particular datetime ? |
104 | - if ( $DTT_ID ) { |
|
104 | + if ($DTT_ID) { |
|
105 | 105 | // get that datetime object |
106 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
106 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
107 | 107 | // if ticket sales for this datetime have exceeded the reg limit... |
108 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
108 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
109 | 109 | return FALSE; |
110 | 110 | } |
111 | 111 | } |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
121 | 121 | * @return mixed(int|string) status int if the display string isn't requested |
122 | 122 | */ |
123 | - public function ticket_status( $display = FALSE ) { |
|
124 | - if ( ! $this->is_remaining() ) { |
|
125 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
123 | + public function ticket_status($display = FALSE) { |
|
124 | + if ( ! $this->is_remaining()) { |
|
125 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
126 | 126 | } |
127 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
128 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
127 | + if ($this->get('TKT_deleted')) { |
|
128 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
129 | 129 | } |
130 | - if ( $this->is_expired() ) { |
|
131 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
130 | + if ($this->is_expired()) { |
|
131 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
132 | 132 | } |
133 | - if ( $this->is_pending() ) { |
|
134 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
133 | + if ($this->is_pending()) { |
|
134 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
135 | 135 | } |
136 | - if ( $this->is_on_sale() ) { |
|
137 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
136 | + if ($this->is_on_sale()) { |
|
137 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
138 | 138 | } |
139 | 139 | return ''; |
140 | 140 | } |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
149 | 149 | * @return boolean true = tickets remaining, false not. |
150 | 150 | */ |
151 | - public function is_remaining( $DTT_ID = 0 ) { |
|
152 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
153 | - if ( $num_remaining === 0 ) { |
|
151 | + public function is_remaining($DTT_ID = 0) { |
|
152 | + $num_remaining = $this->remaining($DTT_ID); |
|
153 | + if ($num_remaining === 0) { |
|
154 | 154 | return FALSE; |
155 | 155 | } |
156 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
156 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
157 | 157 | return FALSE; |
158 | 158 | } |
159 | 159 | return TRUE; |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | * all related datetimes |
168 | 168 | * @return int |
169 | 169 | */ |
170 | - public function remaining( $DTT_ID = 0 ) { |
|
170 | + public function remaining($DTT_ID = 0) { |
|
171 | 171 | // are we checking availability for a particular datetime ? |
172 | - if ( $DTT_ID ) { |
|
172 | + if ($DTT_ID) { |
|
173 | 173 | // get array with the one requested datetime |
174 | - $datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
174 | + $datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
175 | 175 | } else { |
176 | 176 | // we need to check availability of ALL datetimes |
177 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
177 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
178 | 178 | } |
179 | 179 | // d( $datetimes ); |
180 | 180 | // if datetime reg limit is not unlimited |
181 | - if ( ! empty( $datetimes ) ) { |
|
181 | + if ( ! empty($datetimes)) { |
|
182 | 182 | // although TKT_qty and $datetime->spaces_remaining() could both be EE_INF |
183 | 183 | // we only need to check for EE_INF explicitly if we want to optimize. |
184 | 184 | // because EE_INF - x = EE_INF; and min(x,EE_INF) = x; |
185 | 185 | $tickets_remaining = $this->qty() - $this->sold(); |
186 | - foreach ( $datetimes as $datetime ) { |
|
187 | - if ( $datetime instanceof EE_Datetime ) { |
|
188 | - $tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() ); |
|
186 | + foreach ($datetimes as $datetime) { |
|
187 | + if ($datetime instanceof EE_Datetime) { |
|
188 | + $tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining()); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $tickets_remaining; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return int |
201 | 201 | */ |
202 | 202 | function min() { |
203 | - return $this->get( 'TKT_min' ); |
|
203 | + return $this->get('TKT_min'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | public function is_expired() { |
213 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
213 | + return ($this->get_raw('TKT_end_date') < time()); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | 222 | public function is_pending() { |
223 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
223 | + return ($this->get_raw('TKT_start_date') > time()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return boolean |
231 | 231 | */ |
232 | 232 | public function is_on_sale() { |
233 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
233 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
245 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
246 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
244 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
245 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
246 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
247 | 247 | |
248 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
248 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | * @return EE_Datetime |
256 | 256 | */ |
257 | 257 | public function first_datetime() { |
258 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
259 | - return reset( $datetimes ); |
|
258 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
259 | + return reset($datetimes); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @param array $query_params see EEM_Base::get_all() |
268 | 268 | * @return EE_Datetime[] |
269 | 269 | */ |
270 | - public function datetimes( $query_params = array() ) { |
|
271 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
272 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
270 | + public function datetimes($query_params = array()) { |
|
271 | + if ( ! isset($query_params['order_by'])) { |
|
272 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
273 | 273 | } |
274 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
274 | + return $this->get_many_related('Datetime', $query_params); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @return EE_Datetime |
282 | 282 | */ |
283 | 283 | public function last_datetime() { |
284 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
285 | - return end( $datetimes ); |
|
284 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
285 | + return end($datetimes); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -296,22 +296,22 @@ discard block |
||
296 | 296 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
297 | 297 | * @return mixed (array|int) how many tickets have sold |
298 | 298 | */ |
299 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
299 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
300 | 300 | $total = 0; |
301 | 301 | $tickets_sold = $this->_all_tickets_sold(); |
302 | - switch ( $what ) { |
|
302 | + switch ($what) { |
|
303 | 303 | case 'ticket' : |
304 | - return $tickets_sold[ 'ticket' ]; |
|
304 | + return $tickets_sold['ticket']; |
|
305 | 305 | break; |
306 | 306 | case 'datetime' : |
307 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
307 | + if (empty($tickets_sold['datetime'])) { |
|
308 | 308 | return $total; |
309 | 309 | } |
310 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
311 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
310 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
311 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
312 | 312 | return $total; |
313 | 313 | } |
314 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
314 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
315 | 315 | break; |
316 | 316 | default: |
317 | 317 | return $total; |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | * @return EE_Ticket[] |
326 | 326 | */ |
327 | 327 | protected function _all_tickets_sold() { |
328 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
328 | + $datetimes = $this->get_many_related('Datetime'); |
|
329 | 329 | $tickets_sold = array(); |
330 | - if ( ! empty( $datetimes ) ) { |
|
331 | - foreach ( $datetimes as $datetime ) { |
|
332 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
330 | + if ( ! empty($datetimes)) { |
|
331 | + foreach ($datetimes as $datetime) { |
|
332 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | //Tickets sold |
336 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
336 | + $tickets_sold['ticket'] = $this->sold(); |
|
337 | 337 | return $tickets_sold; |
338 | 338 | } |
339 | 339 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
347 | 347 | * @return EE_Price |
348 | 348 | */ |
349 | - public function base_price( $return_array = FALSE ) { |
|
350 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
351 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
349 | + public function base_price($return_array = FALSE) { |
|
350 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
351 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return EE_Price[] |
361 | 361 | */ |
362 | 362 | public function price_modifiers() { |
363 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
364 | - return $this->prices( $query_params ); |
|
363 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
364 | + return $this->prices($query_params); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param array $query_params like EEM_Base::get_all |
372 | 372 | * @return EE_Price[] |
373 | 373 | */ |
374 | - public function prices( $query_params = array() ) { |
|
375 | - return $this->get_many_related( 'Price', $query_params ); |
|
374 | + public function prices($query_params = array()) { |
|
375 | + return $this->get_many_related('Price', $query_params); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @param array $query_params see EEM_Base::get_all() |
383 | 383 | * @return EE_Datetime_Ticket |
384 | 384 | */ |
385 | - public function datetime_tickets( $query_params = array() ) { |
|
386 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
385 | + public function datetime_tickets($query_params = array()) { |
|
386 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param boolean $show_deleted |
395 | 395 | * @return EE_Datetime[] |
396 | 396 | */ |
397 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
398 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
397 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
398 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | function ID() { |
408 | - return $this->get( 'TKT_ID' ); |
|
408 | + return $this->get('TKT_ID'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return EE_Ticket_Template |
430 | 430 | */ |
431 | 431 | public function template() { |
432 | - return $this->get_first_related( 'Ticket_Template' ); |
|
432 | + return $this->get_first_related('Ticket_Template'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @return bool |
449 | 449 | */ |
450 | 450 | public function ticket_price() { |
451 | - return $this->get( 'TKT_price' ); |
|
451 | + return $this->get('TKT_price'); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return mixed |
458 | 458 | */ |
459 | 459 | public function pretty_price() { |
460 | - return $this->get_pretty( 'TKT_price' ); |
|
460 | + return $this->get_pretty('TKT_price'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @param bool $no_cache |
477 | 477 | * @return float |
478 | 478 | */ |
479 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
480 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
479 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
480 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
481 | 481 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
482 | 482 | } |
483 | - return (float)$this->_ticket_total_with_taxes; |
|
483 | + return (float) $this->_ticket_total_with_taxes; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
487 | 487 | |
488 | 488 | public function ensure_TKT_Price_correct() { |
489 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
489 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
490 | 490 | $this->save(); |
491 | 491 | } |
492 | 492 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return float |
497 | 497 | */ |
498 | 498 | public function get_ticket_subtotal() { |
499 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
499 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @return float |
507 | 507 | */ |
508 | 508 | public function get_ticket_taxes_total_for_admin() { |
509 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
509 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @param string $name |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - function set_name( $name ) { |
|
520 | - $this->set( 'TKT_name', $name ); |
|
519 | + function set_name($name) { |
|
520 | + $this->set('TKT_name', $name); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return string |
528 | 528 | */ |
529 | 529 | function description() { |
530 | - return $this->get( 'TKT_description' ); |
|
530 | + return $this->get('TKT_description'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * @param string $description |
538 | 538 | * @return boolean |
539 | 539 | */ |
540 | - function set_description( $description ) { |
|
541 | - $this->set( 'TKT_description', $description ); |
|
540 | + function set_description($description) { |
|
541 | + $this->set('TKT_description', $description); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @param string $tm_frmt |
550 | 550 | * @return string |
551 | 551 | */ |
552 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
553 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
552 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
553 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | * @param string $start_date |
561 | 561 | * @return void |
562 | 562 | */ |
563 | - function set_start_date( $start_date ) { |
|
564 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
563 | + function set_start_date($start_date) { |
|
564 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | * @param string $tm_frmt |
573 | 573 | * @return string |
574 | 574 | */ |
575 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
576 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
575 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
576 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | * @param string $end_date |
584 | 584 | * @return void |
585 | 585 | */ |
586 | - function set_end_date( $end_date ) { |
|
587 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
586 | + function set_end_date($end_date) { |
|
587 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
598 | 598 | */ |
599 | - function set_end_time( $time ) { |
|
600 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
599 | + function set_end_time($time) { |
|
600 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @param int $min |
608 | 608 | * @return boolean |
609 | 609 | */ |
610 | - function set_min( $min ) { |
|
611 | - $this->set( 'TKT_min', $min ); |
|
610 | + function set_min($min) { |
|
611 | + $this->set('TKT_min', $min); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @return int |
619 | 619 | */ |
620 | 620 | function max() { |
621 | - return $this->get( 'TKT_max' ); |
|
621 | + return $this->get('TKT_max'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | * @param int $max |
629 | 629 | * @return boolean |
630 | 630 | */ |
631 | - function set_max( $max ) { |
|
632 | - $this->set( 'TKT_max', $max ); |
|
631 | + function set_max($max) { |
|
632 | + $this->set('TKT_max', $max); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @param float $price |
640 | 640 | * @return boolean |
641 | 641 | */ |
642 | - function set_price( $price ) { |
|
643 | - $this->set( 'TKT_price', $price ); |
|
642 | + function set_price($price) { |
|
643 | + $this->set('TKT_price', $price); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @return int |
651 | 651 | */ |
652 | 652 | function sold() { |
653 | - return $this->get_raw( 'TKT_sold' ); |
|
653 | + return $this->get_raw('TKT_sold'); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | * @param int $qty |
661 | 661 | * @return boolean |
662 | 662 | */ |
663 | - function increase_sold( $qty = 1 ) { |
|
663 | + function increase_sold($qty = 1) { |
|
664 | 664 | $sold = $this->sold() + $qty; |
665 | - $this->_increase_sold_for_datetimes( $qty ); |
|
666 | - return $this->set_sold( $sold ); |
|
665 | + $this->_increase_sold_for_datetimes($qty); |
|
666 | + return $this->set_sold($sold); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -673,12 +673,12 @@ discard block |
||
673 | 673 | * @param int $qty |
674 | 674 | * @return boolean |
675 | 675 | */ |
676 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
676 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
677 | 677 | $datetimes = $this->datetimes(); |
678 | - if ( is_array( $datetimes ) ) { |
|
679 | - foreach ( $datetimes as $datetime ) { |
|
680 | - if ( $datetime instanceof EE_Datetime ) { |
|
681 | - $datetime->increase_sold( $qty ); |
|
678 | + if (is_array($datetimes)) { |
|
679 | + foreach ($datetimes as $datetime) { |
|
680 | + if ($datetime instanceof EE_Datetime) { |
|
681 | + $datetime->increase_sold($qty); |
|
682 | 682 | $datetime->save(); |
683 | 683 | } |
684 | 684 | } |
@@ -692,10 +692,10 @@ discard block |
||
692 | 692 | * @param int $sold |
693 | 693 | * @return boolean |
694 | 694 | */ |
695 | - function set_sold( $sold ) { |
|
695 | + function set_sold($sold) { |
|
696 | 696 | // sold can not go below zero |
697 | - $sold = max( 0, $sold ); |
|
698 | - $this->set( 'TKT_sold', $sold ); |
|
697 | + $sold = max(0, $sold); |
|
698 | + $this->set('TKT_sold', $sold); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
@@ -705,10 +705,10 @@ discard block |
||
705 | 705 | * @param int $qty |
706 | 706 | * @return boolean |
707 | 707 | */ |
708 | - function decrease_sold( $qty = 1 ) { |
|
708 | + function decrease_sold($qty = 1) { |
|
709 | 709 | $sold = $this->sold() - $qty; |
710 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
711 | - return $this->set_sold( $sold ); |
|
710 | + $this->_decrease_sold_for_datetimes($qty); |
|
711 | + return $this->set_sold($sold); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | |
@@ -719,12 +719,12 @@ discard block |
||
719 | 719 | * @param int $qty |
720 | 720 | * @return boolean |
721 | 721 | */ |
722 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
722 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
723 | 723 | $datetimes = $this->datetimes(); |
724 | - if ( is_array( $datetimes ) ) { |
|
725 | - foreach ( $datetimes as $datetime ) { |
|
726 | - if ( $datetime instanceof EE_Datetime ) { |
|
727 | - $datetime->decrease_sold( $qty ); |
|
724 | + if (is_array($datetimes)) { |
|
725 | + foreach ($datetimes as $datetime) { |
|
726 | + if ($datetime instanceof EE_Datetime) { |
|
727 | + $datetime->decrease_sold($qty); |
|
728 | 728 | $datetime->save(); |
729 | 729 | } |
730 | 730 | } |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @return int |
747 | 747 | */ |
748 | - function qty( $context = '' ) { |
|
749 | - switch ( $context ) { |
|
748 | + function qty($context = '') { |
|
749 | + switch ($context) { |
|
750 | 750 | case 'reg_limit' : |
751 | 751 | return $this->real_quantity_on_ticket(); |
752 | 752 | case 'saleable' : |
753 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
753 | + return $this->real_quantity_on_ticket('saleable'); |
|
754 | 754 | default: |
755 | - return $this->get_raw( 'TKT_qty' ); |
|
755 | + return $this->get_raw('TKT_qty'); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -769,38 +769,38 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @return int |
771 | 771 | */ |
772 | - function real_quantity_on_ticket( $context = 'reg_limit' ) { |
|
772 | + function real_quantity_on_ticket($context = 'reg_limit') { |
|
773 | 773 | // start with the original db value for ticket quantity |
774 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
774 | + $raw = $this->get_raw('TKT_qty'); |
|
775 | 775 | // return immediately if it's zero |
776 | - if ( $raw === 0 ) { |
|
776 | + if ($raw === 0) { |
|
777 | 777 | return $raw; |
778 | 778 | } |
779 | 779 | // ensure qty doesn't exceed raw value for THIS ticket |
780 | - $qty = min( EE_INF, $raw ); |
|
780 | + $qty = min(EE_INF, $raw); |
|
781 | 781 | // NOW that we know the maximum number of tickets available for the ticket |
782 | 782 | // we need to calculate the maximum number of tickets available for the datetime |
783 | 783 | // without really factoring this ticket into the calculations |
784 | 784 | $datetimes = $this->datetimes(); |
785 | - foreach ( $datetimes as $datetime ) { |
|
786 | - if ( $datetime instanceof EE_Datetime ) { |
|
785 | + foreach ($datetimes as $datetime) { |
|
786 | + if ($datetime instanceof EE_Datetime) { |
|
787 | 787 | // initialize with no restrictions for each datetime |
788 | 788 | // but adjust datetime qty based on datetime reg limit |
789 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
789 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
790 | 790 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
791 | 791 | // for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in) |
792 | - if ( $context == 'saleable' ) { |
|
793 | - $datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 ); |
|
792 | + if ($context == 'saleable') { |
|
793 | + $datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0); |
|
794 | 794 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
795 | 795 | } |
796 | - $qty = min( $datetime_qty, $qty ); |
|
796 | + $qty = min($datetime_qty, $qty); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | } |
800 | 800 | // we need to factor in the details for this specific ticket |
801 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
801 | + if ($qty > 0 && $context == 'saleable') { |
|
802 | 802 | // and subtract the sales for THIS ticket |
803 | - $qty = max( $qty - $this->sold(), 0 ); |
|
803 | + $qty = max($qty - $this->sold(), 0); |
|
804 | 804 | //echo ' $qty: ' . $qty . "<br />"; |
805 | 805 | } |
806 | 806 | //echo '$qty: ' . $qty . "<br />"; |
@@ -816,14 +816,14 @@ discard block |
||
816 | 816 | * @return bool |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - function set_qty( $qty ) { |
|
819 | + function set_qty($qty) { |
|
820 | 820 | $datetimes = $this->datetimes(); |
821 | - foreach ( $datetimes as $datetime ) { |
|
822 | - if ( $datetime instanceof EE_Datetime ) { |
|
823 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
821 | + foreach ($datetimes as $datetime) { |
|
822 | + if ($datetime instanceof EE_Datetime) { |
|
823 | + $qty = min($qty, $datetime->reg_limit()); |
|
824 | 824 | } |
825 | 825 | } |
826 | - $this->set( 'TKT_qty', $qty ); |
|
826 | + $this->set('TKT_qty', $qty); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * @return int |
834 | 834 | */ |
835 | 835 | function uses() { |
836 | - return $this->get( 'TKT_uses' ); |
|
836 | + return $this->get('TKT_uses'); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | * @param int $uses |
844 | 844 | * @return boolean |
845 | 845 | */ |
846 | - function set_uses( $uses ) { |
|
847 | - $this->set( 'TKT_uses', $uses ); |
|
846 | + function set_uses($uses) { |
|
847 | + $this->set('TKT_uses', $uses); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | * @return boolean |
855 | 855 | */ |
856 | 856 | public function required() { |
857 | - return $this->get( 'TKT_required' ); |
|
857 | + return $this->get('TKT_required'); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | |
@@ -864,8 +864,8 @@ discard block |
||
864 | 864 | * @param boolean $required |
865 | 865 | * @return boolean |
866 | 866 | */ |
867 | - public function set_required( $required ) { |
|
868 | - $this->set( 'TKT_required', $required ); |
|
867 | + public function set_required($required) { |
|
868 | + $this->set('TKT_required', $required); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * @return boolean |
876 | 876 | */ |
877 | 877 | function taxable() { |
878 | - return $this->get( 'TKT_taxable' ); |
|
878 | + return $this->get('TKT_taxable'); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -885,8 +885,8 @@ discard block |
||
885 | 885 | * @param boolean $taxable |
886 | 886 | * @return boolean |
887 | 887 | */ |
888 | - function set_taxable( $taxable ) { |
|
889 | - $this->set( 'TKT_taxable', $taxable ); |
|
888 | + function set_taxable($taxable) { |
|
889 | + $this->set('TKT_taxable', $taxable); |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * @return boolean |
897 | 897 | */ |
898 | 898 | function is_default() { |
899 | - return $this->get( 'TKT_is_default' ); |
|
899 | + return $this->get('TKT_is_default'); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | |
@@ -906,8 +906,8 @@ discard block |
||
906 | 906 | * @param boolean $is_default |
907 | 907 | * @return boolean |
908 | 908 | */ |
909 | - function set_is_default( $is_default ) { |
|
910 | - $this->set( 'TKT_is_default', $is_default ); |
|
909 | + function set_is_default($is_default) { |
|
910 | + $this->set('TKT_is_default', $is_default); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | * @return int |
918 | 918 | */ |
919 | 919 | function order() { |
920 | - return $this->get( 'TKT_order' ); |
|
920 | + return $this->get('TKT_order'); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | * @param int $order |
928 | 928 | * @return boolean |
929 | 929 | */ |
930 | - function set_order( $order ) { |
|
931 | - $this->set( 'TKT_order', $order ); |
|
930 | + function set_order($order) { |
|
931 | + $this->set('TKT_order', $order); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | * @return int |
939 | 939 | */ |
940 | 940 | function row() { |
941 | - return $this->get( 'TKT_row' ); |
|
941 | + return $this->get('TKT_row'); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | * @param int $row |
949 | 949 | * @return boolean |
950 | 950 | */ |
951 | - function set_row( $row ) { |
|
952 | - $this->set( 'TKT_row', $row ); |
|
951 | + function set_row($row) { |
|
952 | + $this->set('TKT_row', $row); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * @return boolean |
960 | 960 | */ |
961 | 961 | function deleted() { |
962 | - return $this->get( 'TKT_deleted' ); |
|
962 | + return $this->get('TKT_deleted'); |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | * @param boolean $deleted |
970 | 970 | * @return boolean |
971 | 971 | */ |
972 | - function set_deleted( $deleted ) { |
|
973 | - $this->set( 'TKT_deleted', $deleted ); |
|
972 | + function set_deleted($deleted) { |
|
973 | + $this->set('TKT_deleted', $deleted); |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | * @return int |
981 | 981 | */ |
982 | 982 | function parent_ID() { |
983 | - return $this->get( 'TKT_parent' ); |
|
983 | + return $this->get('TKT_parent'); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | * @param int $parent |
991 | 991 | * @return boolean |
992 | 992 | */ |
993 | - function set_parent_ID( $parent ) { |
|
994 | - $this->set( 'TKT_parent', $parent ); |
|
993 | + function set_parent_ID($parent) { |
|
994 | + $this->set('TKT_parent', $parent); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | |
@@ -1002,10 +1002,10 @@ discard block |
||
1002 | 1002 | */ |
1003 | 1003 | function name_and_info() { |
1004 | 1004 | $times = array(); |
1005 | - foreach ( $this->datetimes() as $datetime ) { |
|
1005 | + foreach ($this->datetimes() as $datetime) { |
|
1006 | 1006 | $times[] = $datetime->start_date_and_time(); |
1007 | 1007 | } |
1008 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
1008 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | * @return string |
1016 | 1016 | */ |
1017 | 1017 | function name() { |
1018 | - return $this->get( 'TKT_name' ); |
|
1018 | + return $this->get('TKT_name'); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @return float |
1026 | 1026 | */ |
1027 | 1027 | function price() { |
1028 | - return $this->get( 'TKT_price' ); |
|
1028 | + return $this->get('TKT_price'); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | * @param array $query_params like EEM_Base::get_all's |
1036 | 1036 | * @return EE_Registration[] |
1037 | 1037 | */ |
1038 | - public function registrations( $query_params = array() ) { |
|
1039 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1038 | + public function registrations($query_params = array()) { |
|
1039 | + return $this->get_many_related('Registration', $query_params); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
1047 | 1047 | * @return int |
1048 | 1048 | */ |
1049 | 1049 | public function update_tickets_sold() { |
1050 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
1051 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
1050 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
1051 | + $this->set_sold($count_regs_for_this_ticket); |
|
1052 | 1052 | $this->save(); |
1053 | 1053 | return $count_regs_for_this_ticket; |
1054 | 1054 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param array $query_params like EEM_Base::get_all's |
1061 | 1061 | * @return int |
1062 | 1062 | */ |
1063 | - public function count_registrations( $query_params = array() ) { |
|
1063 | + public function count_registrations($query_params = array()) { |
|
1064 | 1064 | return $this->count_related('Registration', $query_params); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | public function get_related_event() { |
1086 | 1086 | //get one datetime to use for getting the event |
1087 | 1087 | $datetime = $this->first_datetime(); |
1088 | - if ( $datetime instanceof EE_Datetime ) { |
|
1088 | + if ($datetime instanceof EE_Datetime) { |
|
1089 | 1089 | return $datetime->event(); |
1090 | 1090 | } |
1091 | 1091 | return null; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
59 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
60 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
61 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
59 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
60 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
61 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
62 | 62 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
63 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
63 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
64 | 64 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
65 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
66 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
65 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
66 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
67 | 67 | )); |
68 | 68 | $this->_model_relations = array( |
69 | 69 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | 79 | //account for default tickets in the caps |
80 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - parent::__construct( $timezone ); |
|
80 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + parent::__construct($timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_all_default_tickets() { |
93 | 93 | /** @type EE_Ticket[] $tickets */ |
94 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) ); |
|
94 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC'))); |
|
95 | 95 | //we need to set the start date and end date to today's date and the start of the default dtt |
96 | - return $this->_set_default_dates( $tickets ); |
|
96 | + return $this->_set_default_dates($tickets); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Ticket[] $tickets |
104 | 104 | * @return EE_Ticket[] |
105 | 105 | */ |
106 | - private function _set_default_dates( $tickets ) { |
|
107 | - foreach ( $tickets as $ticket ) { |
|
108 | - $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) ); |
|
109 | - $ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
110 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
106 | + private function _set_default_dates($tickets) { |
|
107 | + foreach ($tickets as $ticket) { |
|
108 | + $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true)); |
|
109 | + $ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
110 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $tickets; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param array $query_params |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
126 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
125 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
126 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param EE_Ticket[] $tickets |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function update_tickets_sold($tickets){ |
|
137 | - foreach($tickets as $ticket){ |
|
136 | + public function update_tickets_sold($tickets) { |
|
137 | + foreach ($tickets as $ticket) { |
|
138 | 138 | /* @var $ticket EE_Ticket */ |
139 | 139 | $ticket->update_tickets_sold(); |
140 | 140 | } |
@@ -8,32 +8,32 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config(); |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config(); |
|
19 | 19 | ob_start(); |
20 | 20 | |
21 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
22 | - if ( $ticket instanceof EE_Ticket ) { |
|
21 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
22 | + if ($ticket instanceof EE_Ticket) { |
|
23 | 23 | // d( $ticket ); |
24 | - $max =$ticket->max(); |
|
24 | + $max = $ticket->max(); |
|
25 | 25 | $min = 0; |
26 | 26 | $remaining = $ticket->remaining(); |
27 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
27 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
28 | 28 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
29 | - $max = min( $remaining, $max_atndz ); |
|
29 | + $max = min($remaining, $max_atndz); |
|
30 | 30 | // but... we also want to restrict the number of tickets by the ticket max setting, |
31 | 31 | // however, the max still can't be higher than what was just set above |
32 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
32 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
33 | 33 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
34 | 34 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
35 | 35 | // and if the ticket is required, then make sure that min qty is at least 1 |
36 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
36 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
37 | 37 | } else { |
38 | 38 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
39 | 39 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -42,40 +42,40 @@ discard block |
||
42 | 42 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
43 | 43 | $ticket_bundle = FALSE; |
44 | 44 | // for ticket bundles, set min and max qty the same |
45 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
45 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
46 | 46 | $ticket_price = $ticket_price * $ticket->min(); |
47 | 47 | $ticket_bundle = TRUE; |
48 | 48 | } |
49 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
49 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
50 | 50 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
51 | 51 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
52 | 52 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
53 | 53 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
54 | 54 | // check ticket status |
55 | - switch ( $tkt_status ) { |
|
55 | + switch ($tkt_status) { |
|
56 | 56 | // sold_out |
57 | 57 | case EE_Ticket::sold_out : |
58 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
58 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
59 | 59 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
60 | 60 | break; |
61 | 61 | // expired |
62 | 62 | case EE_Ticket::expired : |
63 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
63 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
64 | 64 | $status_class = 'ticket-sales-expired lt-grey-text'; |
65 | 65 | break; |
66 | 66 | // archived |
67 | 67 | case EE_Ticket::archived : |
68 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
68 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
69 | 69 | $status_class = 'archived-ticket hidden'; |
70 | 70 | break; |
71 | 71 | // pending |
72 | 72 | case EE_Ticket::pending : |
73 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
73 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
74 | 74 | $status_class = 'ticket-pending'; |
75 | 75 | break; |
76 | 76 | // onsale |
77 | 77 | case EE_Ticket::onsale : |
78 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
78 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
79 | 79 | $status_class = 'ticket-on-sale'; |
80 | 80 | break; |
81 | 81 | } |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @var string|bool |
92 | 92 | */ |
93 | - if ( false !== ( $new_row_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
93 | + if (false !== ($new_row_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
94 | 94 | echo $new_row_content; |
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | ?> |
98 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
98 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
99 | 99 | <?php |
100 | 100 | /** |
101 | 101 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -107,24 +107,24 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @var string|bool |
109 | 109 | */ |
110 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
110 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
111 | 111 | echo $new_row_cells_content; |
112 | 112 | echo '</tr>'; |
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | ?> |
116 | 116 | <td class="tckt-slctr-tbl-td-name"> |
117 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
118 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
119 | - <a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
120 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
117 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
118 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
119 | + <a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
120 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
121 | 121 | </a> |
122 | - <a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
123 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
122 | + <a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
123 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
124 | 124 | </a> |
125 | 125 | <?php endif; //end show details check ?> |
126 | - <?php if ( $ticket->required() ) { ?> |
|
127 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
126 | + <?php if ($ticket->required()) { ?> |
|
127 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
128 | 128 | <?php } ?> |
129 | 129 | <?php |
130 | 130 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -138,63 +138,63 @@ discard block |
||
138 | 138 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
139 | 139 | ?> |
140 | 140 | </td> |
141 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
142 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
143 | - if ( $ticket_bundle ) { |
|
144 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
141 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
142 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
143 | + if ($ticket_bundle) { |
|
144 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
145 | 145 | } else { |
146 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
146 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
147 | 147 | }?></span> </td> |
148 | 148 | <?php } ?> |
149 | 149 | <td class="tckt-slctr-tbl-td-qty cntr"> |
150 | 150 | <?php |
151 | 151 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
152 | 152 | // sold out or other status ? |
153 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
153 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
154 | 154 | ?> |
155 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
155 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
156 | 156 | <?php |
157 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
157 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
158 | 158 | echo $ticket_status; |
159 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
159 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
160 | 160 | ?> |
161 | 161 | <div class="ticket-pending-pg"> |
162 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
163 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
162 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
163 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
164 | 164 | </div> |
165 | 165 | <?php |
166 | 166 | // min qty purchasable is less than tickets available |
167 | - } else if ( $ticket->min() > $remaining ) { |
|
167 | + } else if ($ticket->min() > $remaining) { |
|
168 | 168 | ?> |
169 | 169 | <div class="archived-ticket-pg"> |
170 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
170 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
171 | 171 | </div> |
172 | 172 | <?php |
173 | 173 | // if only one attendee is allowed to register at a time |
174 | - } else if ( $max_atndz == 1 ) { |
|
174 | + } else if ($max_atndz == 1) { |
|
175 | 175 | // display submit button since we have tickets available |
176 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
176 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
177 | 177 | ?> |
178 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
178 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
179 | 179 | <?php |
180 | 180 | $hidden_input_qty = FALSE; |
181 | 181 | |
182 | - } else if ( $max_atndz == 0 ) { |
|
183 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
184 | - } elseif ( $max > 0 ) { |
|
182 | + } else if ($max_atndz == 0) { |
|
183 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
184 | + } elseif ($max > 0) { |
|
185 | 185 | // display submit button since we have tickets available |
186 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
186 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
187 | 187 | |
188 | 188 | ?> |
189 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
189 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
190 | 190 | <?php |
191 | 191 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
192 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
192 | + if ( ! $ticket->required() && $min !== 0) { |
|
193 | 193 | ?> |
194 | 194 | <option value="0"> 0 </option> |
195 | 195 | <?php } |
196 | 196 | // offer ticket quantities from the min to the max |
197 | - for ( $i = $min; $i <= $max; $i++) { |
|
197 | + for ($i = $min; $i <= $max; $i++) { |
|
198 | 198 | ?> |
199 | 199 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
200 | 200 | <?php } ?> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | // depending on group reg we need to change the format for qty |
207 | - if ( $hidden_input_qty ) { |
|
207 | + if ($hidden_input_qty) { |
|
208 | 208 | ?> |
209 | 209 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
210 | 210 | <?php |
@@ -214,33 +214,33 @@ discard block |
||
214 | 214 | |
215 | 215 | </td> |
216 | 216 | </tr> |
217 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
218 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
217 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
218 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
219 | 219 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
220 | - <div id="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
|
220 | + <div id="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
|
221 | 221 | |
222 | 222 | <section class="tckt-slctr-tkt-details-sctn"> |
223 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
223 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
224 | 224 | <p><?php echo $ticket->description(); ?></p> |
225 | 225 | |
226 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
226 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
227 | 227 | <section class="tckt-slctr-tkt-price-sctn"> |
228 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
228 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
229 | 229 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
230 | 230 | <table class="tckt-slctr-tkt-details-tbl"> |
231 | 231 | <thead> |
232 | 232 | <tr> |
233 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
234 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
235 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
233 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
234 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
235 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
236 | 236 | </tr> |
237 | 237 | </thead> |
238 | 238 | <tbody> |
239 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
239 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
240 | 240 | <tr> |
241 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
242 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
243 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
241 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
242 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
243 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
244 | 244 | </tr> |
245 | 245 | <?php |
246 | 246 | $running_total = $ticket->base_price()->amount(); |
@@ -248,44 +248,44 @@ discard block |
||
248 | 248 | $running_total = 0; |
249 | 249 | } |
250 | 250 | // now add price modifiers |
251 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
251 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
252 | 252 | <tr> |
253 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
254 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
255 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
253 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
254 | + <?php if ($price_mod->is_percent()) { ?> |
|
255 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
256 | 256 | <?php |
257 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
257 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
258 | 258 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
259 | 259 | ?> |
260 | 260 | <?php } else { ?> |
261 | 261 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
262 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
262 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
263 | 263 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
264 | 264 | <?php } ?> |
265 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
265 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
266 | 266 | <?php $running_total += $new_sub_total; ?> |
267 | 267 | </tr> |
268 | 268 | <?php } ?> |
269 | - <?php if ( $ticket->taxable() ) { ?> |
|
269 | + <?php if ($ticket->taxable()) { ?> |
|
270 | 270 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
271 | 271 | <tr> |
272 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
273 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
272 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
273 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
274 | 274 | </tr> |
275 | 275 | |
276 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
276 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
277 | 277 | <tr> |
278 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
279 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
280 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
281 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
278 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
279 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
280 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
281 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
282 | 282 | <?php $running_total += $tax_amount; ?> |
283 | 283 | </tr> |
284 | 284 | <?php } ?> |
285 | 285 | <?php } ?> |
286 | 286 | <tr> |
287 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
288 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
287 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
288 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
289 | 289 | </tr> |
290 | 290 | </tbody> |
291 | 291 | </table> |
@@ -295,106 +295,106 @@ discard block |
||
295 | 295 | <?php } ?> |
296 | 296 | |
297 | 297 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
298 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
299 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
300 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
301 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
298 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
299 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
300 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
301 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
302 | 302 | </section> |
303 | 303 | <br/> |
304 | 304 | |
305 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
305 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
306 | 306 | |
307 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
307 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
308 | 308 | <section class="tckt-slctr-tkt-quantities-sctn"> |
309 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
310 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
311 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
312 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
309 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
310 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
311 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
312 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
313 | 313 | <?php //$max = min( $max, $max_atndz );?> |
314 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
314 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
315 | 315 | </section> |
316 | 316 | <br/> |
317 | 317 | <?php } ?> |
318 | 318 | |
319 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
319 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
320 | 320 | <section class="tckt-slctr-tkt-uses-sctn"> |
321 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
321 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
322 | 322 | <span class="drk-grey-text small-text no-bold"> - <?php |
323 | 323 | echo apply_filters( |
324 | 324 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
325 | 325 | sprintf( |
326 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
326 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
327 | 327 | '<br/>', |
328 | 328 | '<strong>', |
329 | 329 | '</strong>' |
330 | 330 | ) |
331 | 331 | ); |
332 | 332 | ?></span><br/> |
333 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
333 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
334 | 334 | </section> |
335 | 335 | <?php } ?> |
336 | 336 | |
337 | 337 | <?php |
338 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
338 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
339 | 339 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
340 | - if ( ! empty( $datetimes )) { ?> |
|
340 | + if ( ! empty($datetimes)) { ?> |
|
341 | 341 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
342 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
343 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
342 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
343 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
344 | 344 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
345 | 345 | <table class="tckt-slctr-tkt-details-tbl"> |
346 | 346 | <thead> |
347 | 347 | <tr> |
348 | 348 | <th class="tckt-slctr-tkt-details-date-th"> |
349 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
349 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
350 | 350 | </th> |
351 | 351 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
352 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
352 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
353 | 353 | </th> |
354 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
354 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
355 | 355 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
356 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
356 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
357 | 357 | </th> |
358 | 358 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
359 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
359 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
360 | 360 | </th> |
361 | 361 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
362 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
362 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
363 | 363 | </th> |
364 | 364 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
365 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
365 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
366 | 366 | </th> |
367 | 367 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
368 | 368 | </tr> |
369 | 369 | </thead> |
370 | 370 | <tbody> |
371 | 371 | <?php |
372 | - foreach ( $datetimes as $datetime ) { |
|
373 | - if ( $datetime instanceof EE_Datetime ) { |
|
372 | + foreach ($datetimes as $datetime) { |
|
373 | + if ($datetime instanceof EE_Datetime) { |
|
374 | 374 | ?> |
375 | 375 | |
376 | 376 | <tr> |
377 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
377 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
378 | 378 | <?php $datetime_name = $datetime->name(); ?> |
379 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
380 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
379 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
380 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
381 | 381 | </td> |
382 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
383 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
382 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
383 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
384 | 384 | </td> |
385 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
386 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
385 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
386 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
387 | 387 | <?php echo $ticket->sold(); ?> |
388 | 388 | </td> |
389 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
390 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
389 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
390 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
391 | 391 | </td> |
392 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
392 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
393 | 393 | <?php echo $datetime->sold(); ?> |
394 | 394 | </td> |
395 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
396 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
397 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
395 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
396 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
397 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
398 | 398 | </td> |
399 | 399 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
400 | 400 | </tr> |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | </div> |
413 | 413 | </td> |
414 | 414 | </tr> |
415 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
415 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
416 | 416 | <?php |
417 | 417 | $row++; |
418 | 418 | } |
@@ -421,32 +421,32 @@ discard block |
||
421 | 421 | $ticket_row_html = ob_get_clean(); |
422 | 422 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
423 | 423 | $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false; |
424 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
424 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
425 | 425 | //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
426 | 426 | //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
427 | 427 | //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
428 | 428 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
429 | 429 | remove_filter( |
430 | 430 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
431 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
431 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
432 | 432 | ); |
433 | 433 | remove_filter( |
434 | 434 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
435 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
435 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
436 | 436 | ); |
437 | -if ( ! $hide_ticket_selector ) { |
|
437 | +if ( ! $hide_ticket_selector) { |
|
438 | 438 | ?> |
439 | 439 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
440 | 440 | |
441 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
441 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
442 | 442 | |
443 | 443 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
444 | 444 | <thead> |
445 | 445 | <tr> |
446 | 446 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
447 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
447 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
448 | 448 | </th> |
449 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
449 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
450 | 450 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
451 | 451 | <?php |
452 | 452 | /** |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @param string 'Price' The translatable text to display in the table header for price |
458 | 458 | * @param int $EVT_ID The Event ID |
459 | 459 | */ |
460 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
460 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
461 | 461 | ?> |
462 | 462 | </th> |
463 | 463 | <?php } ?> |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
472 | 472 | * @param int $EVT_ID The Event ID |
473 | 473 | */ |
474 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
474 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
475 | 475 | ?> |
476 | 476 | </th> |
477 | 477 | </tr> |
478 | 478 | </thead> |
479 | 479 | <tbody> |
480 | - <?php echo $ticket_row_html;?> |
|
480 | + <?php echo $ticket_row_html; ?> |
|
481 | 481 | </tbody> |
482 | 482 | </table> |
483 | 483 | |
484 | 484 | <input type="hidden" name="noheader" value="true" /> |
485 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
485 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
486 | 486 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
487 | 487 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
488 | 488 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
489 | 489 | |
490 | 490 | <?php |
491 | -if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
491 | +if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
492 | 492 | echo apply_filters( |
493 | 493 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
494 | 494 | '' |
@@ -496,10 +496,10 @@ discard block |
||
496 | 496 | } |
497 | 497 | ?> |
498 | 498 | |
499 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
499 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
500 | 500 | |
501 | 501 | </div> |
502 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
502 | +<?php } else if (isset($TKT_ID)) { ?> |
|
503 | 503 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
504 | 504 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
505 | 505 | <input type="hidden" name="noheader" value="true"/> |
@@ -508,27 +508,27 @@ discard block |
||
508 | 508 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
509 | 509 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
510 | 510 | <?php |
511 | - if ( $ticket instanceof EE_Ticket ) { |
|
512 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
511 | + if ($ticket instanceof EE_Ticket) { |
|
512 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
513 | 513 | $ticket_description = $ticket->description(); |
514 | 514 | ?> |
515 | 515 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
516 | 516 | <div class="no-tkt-slctr-ticket-content-dv"> |
517 | 517 | <h5><?php echo $ticket->name(); ?></h5> |
518 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
518 | + <?php if ( ! empty($ticket_description)) { ?> |
|
519 | 519 | <p><?php echo $ticket_description; ?></p> |
520 | 520 | <?php } ?> |
521 | 521 | </div> |
522 | 522 | <?php |
523 | 523 | add_filter( |
524 | 524 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
525 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
525 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
526 | 526 | ); |
527 | 527 | add_filter( |
528 | 528 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
529 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
529 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
530 | 530 | ); |
531 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
531 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | ?> |
@@ -595,8 +595,6 @@ |
||
595 | 595 | * converts it into a "remote" filepath (the filepath the currently-in-use |
596 | 596 | * $wp_filesystem needs to use access the folder or file). |
597 | 597 | * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins |
598 | - * @param WP_Filesystem_Base $wp_filesystem we aren't initially sure which one |
|
599 | - * is in use, so you need to provide it |
|
600 | 598 | * @param string $local_filepath the filepath to the folder/file locally |
601 | 599 | * @return string the remote filepath (eg the filepath the filesystem method, eg |
602 | 600 | * ftp or ssh, will use to access the folder |
@@ -27,30 +27,30 @@ discard block |
||
27 | 27 | * @throws EE_Error |
28 | 28 | * @return WP_Filesystem_Base |
29 | 29 | */ |
30 | - private static function _get_wp_filesystem( $filepath = null) { |
|
31 | - if( apply_filters( |
|
30 | + private static function _get_wp_filesystem($filepath = null) { |
|
31 | + if (apply_filters( |
|
32 | 32 | 'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', |
33 | - $filepath && EEH_File::is_in_uploads_folder( $filepath ), |
|
34 | - $filepath ) ) { |
|
35 | - if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) { |
|
36 | - require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
|
33 | + $filepath && EEH_File::is_in_uploads_folder($filepath), |
|
34 | + $filepath )) { |
|
35 | + if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) { |
|
36 | + require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php'); |
|
37 | 37 | $method = 'direct'; |
38 | - $wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); |
|
38 | + $wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method); |
|
39 | 39 | //check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem() |
40 | - if ( ! defined('FS_CHMOD_DIR') ) { |
|
41 | - define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) ); |
|
40 | + if ( ! defined('FS_CHMOD_DIR')) { |
|
41 | + define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755)); |
|
42 | 42 | } |
43 | - if ( ! defined('FS_CHMOD_FILE') ) { |
|
44 | - define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); |
|
43 | + if ( ! defined('FS_CHMOD_FILE')) { |
|
44 | + define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644)); |
|
45 | 45 | } |
46 | - require_once( $wp_filesystem_direct_file ); |
|
47 | - EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() ); |
|
46 | + require_once($wp_filesystem_direct_file); |
|
47 | + EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array()); |
|
48 | 48 | } |
49 | 49 | return EEH_File::$_wp_filesystem_direct; |
50 | 50 | } |
51 | 51 | global $wp_filesystem; |
52 | 52 | // no filesystem setup ??? |
53 | - if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) { |
|
53 | + if ( ! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
54 | 54 | // if some eager beaver's just trying to get in there too early... |
55 | 55 | // let them do it, because we are one of those eager beavers! :P |
56 | 56 | /** |
@@ -63,34 +63,34 @@ discard block |
||
63 | 63 | * and there may be troubles if the WP files are owned by a different user |
64 | 64 | * than the server user. But both of these issues should exist in 4.4 and earlier too |
65 | 65 | */ |
66 | - if ( FALSE && ! did_action( 'wp_loaded' )) { |
|
66 | + if (FALSE && ! did_action('wp_loaded')) { |
|
67 | 67 | $msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'); |
68 | - if ( WP_DEBUG ) { |
|
69 | - $msg .= '<br />' . __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso'); |
|
68 | + if (WP_DEBUG) { |
|
69 | + $msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso'); |
|
70 | 70 | } |
71 | - throw new EE_Error( $msg ); |
|
71 | + throw new EE_Error($msg); |
|
72 | 72 | } else { |
73 | 73 | // should be loaded if we are past the wp_loaded hook... |
74 | - if ( ! function_exists( 'WP_Filesystem' )) { |
|
75 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
76 | - require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
74 | + if ( ! function_exists('WP_Filesystem')) { |
|
75 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
76 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
77 | 77 | } |
78 | 78 | // turn on output buffering so that we can capture the credentials form |
79 | 79 | ob_start(); |
80 | - $credentials = request_filesystem_credentials( '' ); |
|
80 | + $credentials = request_filesystem_credentials(''); |
|
81 | 81 | // store credentials form for the time being |
82 | 82 | EEH_File::$_credentials_form = ob_get_clean(); |
83 | 83 | // basically check for direct or previously configured access |
84 | - if ( ! WP_Filesystem( $credentials ) ) { |
|
84 | + if ( ! WP_Filesystem($credentials)) { |
|
85 | 85 | // if credentials do NOT exist |
86 | - if ( $credentials === FALSE ) { |
|
87 | - add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 ); |
|
88 | - throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso')); |
|
89 | - } elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) { |
|
90 | - add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 ); |
|
86 | + if ($credentials === FALSE) { |
|
87 | + add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999); |
|
88 | + throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso')); |
|
89 | + } elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { |
|
90 | + add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999); |
|
91 | 91 | throw new EE_Error( |
92 | 92 | sprintf( |
93 | - __( 'WP Filesystem Error: $1%s', 'event_espresso' ), |
|
93 | + __('WP Filesystem Error: $1%s', 'event_espresso'), |
|
94 | 94 | $wp_filesystem->errors->get_error_message() ) ); |
95 | 95 | } |
96 | 96 | } |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * display_request_filesystem_credentials_form |
104 | 104 | */ |
105 | 105 | public static function display_request_filesystem_credentials_form() { |
106 | - if ( ! empty( EEH_File::$_credentials_form )) { |
|
107 | - echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>'; |
|
106 | + if ( ! empty(EEH_File::$_credentials_form)) { |
|
107 | + echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>'; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -122,29 +122,29 @@ discard block |
||
122 | 122 | * @throws EE_Error |
123 | 123 | * @return bool |
124 | 124 | */ |
125 | - public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) { |
|
125 | + public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') { |
|
126 | 126 | // load WP_Filesystem and set file permissions |
127 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
128 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
129 | - if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) { |
|
130 | - $file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name; |
|
131 | - $file_name .= ! empty( $file_ext ) ? ' file' : ' folder'; |
|
127 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
128 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
129 | + if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
130 | + $file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name; |
|
131 | + $file_name .= ! empty($file_ext) ? ' file' : ' folder'; |
|
132 | 132 | $msg = sprintf( |
133 | - __( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ), |
|
133 | + __('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'), |
|
134 | 134 | $file_name, |
135 | 135 | '<br />' |
136 | 136 | ); |
137 | - if ( EEH_File::exists( $full_file_path )) { |
|
138 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file ); |
|
137 | + if (EEH_File::exists($full_file_path)) { |
|
138 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file); |
|
139 | 139 | } else { |
140 | 140 | // no file permissions means the file was not found |
141 | 141 | $msg .= sprintf( |
142 | - __( 'Please ensure the following path is correct: "%s".', 'event_espresso' ), |
|
142 | + __('Please ensure the following path is correct: "%s".', 'event_espresso'), |
|
143 | 143 | $full_file_path |
144 | 144 | ); |
145 | 145 | } |
146 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
147 | - throw new EE_Error( $msg . '||' . $msg ); |
|
146 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
147 | + throw new EE_Error($msg.'||'.$msg); |
|
148 | 148 | } |
149 | 149 | return FALSE; |
150 | 150 | } |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages |
162 | 162 | * @return string |
163 | 163 | */ |
164 | - private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){ |
|
164 | + private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') { |
|
165 | 165 | // load WP_Filesystem and set file permissions |
166 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
166 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
167 | 167 | // check file permissions |
168 | - $perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ); |
|
169 | - if ( $perms ) { |
|
168 | + $perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
169 | + if ($perms) { |
|
170 | 170 | // file permissions exist, but way be set incorrectly |
171 | - $type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : ''; |
|
172 | - $type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder'; |
|
171 | + $type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : ''; |
|
172 | + $type_of_file .= ! empty($type_of_file) ? 'file' : 'folder'; |
|
173 | 173 | return sprintf( |
174 | - __( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ), |
|
174 | + __('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'), |
|
175 | 175 | $type_of_file, |
176 | 176 | $perms |
177 | 177 | ); |
178 | 178 | } else { |
179 | 179 | // file exists but file permissions could not be read ?!?! |
180 | 180 | return sprintf( |
181 | - __( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ), |
|
181 | + __('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'), |
|
182 | 182 | $full_file_path |
183 | 183 | ); |
184 | 184 | } |
@@ -196,35 +196,35 @@ discard block |
||
196 | 196 | * can't write to it |
197 | 197 | * @return bool false if folder isn't writable; true if it exists and is writeable, |
198 | 198 | */ |
199 | - public static function ensure_folder_exists_and_is_writable( $folder = '' ){ |
|
200 | - if ( empty( $folder )) { |
|
199 | + public static function ensure_folder_exists_and_is_writable($folder = '') { |
|
200 | + if (empty($folder)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | // remove ending DS |
204 | - $folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' )); |
|
205 | - $parent_folder = EEH_File::get_parent_folder( $folder ); |
|
204 | + $folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\')); |
|
205 | + $parent_folder = EEH_File::get_parent_folder($folder); |
|
206 | 206 | // add DS to folder |
207 | - $folder = EEH_File::end_with_directory_separator( $folder ); |
|
208 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $folder ); |
|
209 | - if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) { |
|
207 | + $folder = EEH_File::end_with_directory_separator($folder); |
|
208 | + $wp_filesystem = EEH_File::_get_wp_filesystem($folder); |
|
209 | + if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
210 | 210 | //ok so it doesn't exist. Does its parent? Can we write to it? |
211 | - if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) { |
|
211 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
212 | 212 | return false; |
213 | 213 | } |
214 | - if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) { |
|
214 | + if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
215 | 215 | return false; |
216 | 216 | } else { |
217 | - if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) { |
|
218 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
219 | - $msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder ); |
|
220 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder ); |
|
221 | - throw new EE_Error( $msg ); |
|
217 | + if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
218 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
219 | + $msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder); |
|
220 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder); |
|
221 | + throw new EE_Error($msg); |
|
222 | 222 | } |
223 | 223 | return false; |
224 | 224 | } |
225 | - EEH_File::add_htaccess_deny_from_all( $folder ); |
|
225 | + EEH_File::add_htaccess_deny_from_all($folder); |
|
226 | 226 | } |
227 | - } elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
227 | + } elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | return true; |
@@ -239,15 +239,15 @@ discard block |
||
239 | 239 | * @throws EE_Error |
240 | 240 | * @return bool |
241 | 241 | */ |
242 | - public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){ |
|
242 | + public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') { |
|
243 | 243 | // load WP_Filesystem and set file permissions |
244 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_path ); |
|
245 | - $full_path = EEH_File::standardise_directory_separators( $full_path ); |
|
246 | - if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) { |
|
247 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
248 | - $msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder ); |
|
249 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path ); |
|
250 | - throw new EE_Error( $msg ); |
|
244 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_path); |
|
245 | + $full_path = EEH_File::standardise_directory_separators($full_path); |
|
246 | + if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) { |
|
247 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
248 | + $msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder); |
|
249 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path); |
|
250 | + throw new EE_Error($msg); |
|
251 | 251 | } |
252 | 252 | return FALSE; |
253 | 253 | } |
@@ -264,25 +264,25 @@ discard block |
||
264 | 264 | * @throws EE_Error |
265 | 265 | * @return bool |
266 | 266 | */ |
267 | - public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) { |
|
267 | + public static function ensure_file_exists_and_is_writable($full_file_path = '') { |
|
268 | 268 | // load WP_Filesystem and set file permissions |
269 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
270 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
271 | - $parent_folder = EEH_File::get_parent_folder( $full_file_path ); |
|
272 | - if ( ! EEH_File::exists( $full_file_path )) { |
|
273 | - if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) { |
|
269 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
270 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
271 | + $parent_folder = EEH_File::get_parent_folder($full_file_path); |
|
272 | + if ( ! EEH_File::exists($full_file_path)) { |
|
273 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
274 | 274 | return false; |
275 | 275 | } |
276 | - if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) { |
|
277 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
278 | - $msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path ); |
|
279 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path ); |
|
280 | - throw new EE_Error( $msg ); |
|
276 | + if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
277 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
278 | + $msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path); |
|
279 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
280 | + throw new EE_Error($msg); |
|
281 | 281 | } |
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | } |
285 | - if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) { |
|
285 | + if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | return true; |
@@ -294,15 +294,15 @@ discard block |
||
294 | 294 | * @param string $file_or_folder_path |
295 | 295 | * @return string parent folder, ENDING with a directory separator |
296 | 296 | */ |
297 | - public static function get_parent_folder( $file_or_folder_path ) { |
|
297 | + public static function get_parent_folder($file_or_folder_path) { |
|
298 | 298 | //find the last DS, ignoring a DS on the very end |
299 | 299 | //eg if given "/var/something/somewhere/", we want to get "somewhere"'s |
300 | 300 | //parent folder, "/var/something/" |
301 | - $ds = strrpos( $file_or_folder_path, DS, -2 ); |
|
302 | - return substr( $file_or_folder_path, 0, $ds + 1 ); |
|
301 | + $ds = strrpos($file_or_folder_path, DS, -2); |
|
302 | + return substr($file_or_folder_path, 0, $ds + 1); |
|
303 | 303 | } |
304 | 304 | |
305 | - public static function ensure_folder_exists_recursively( $folder ) { |
|
305 | + public static function ensure_folder_exists_recursively($folder) { |
|
306 | 306 | |
307 | 307 | } |
308 | 308 | |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | * @param string $full_file_path |
314 | 314 | * @return string |
315 | 315 | */ |
316 | - public static function get_file_contents( $full_file_path = '' ){ |
|
317 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
318 | - if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) { |
|
316 | + public static function get_file_contents($full_file_path = '') { |
|
317 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
318 | + if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) { |
|
319 | 319 | // load WP_Filesystem and set file permissions |
320 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
321 | - return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ); |
|
320 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
321 | + return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
322 | 322 | } |
323 | 323 | return ''; |
324 | 324 | } |
@@ -333,26 +333,26 @@ discard block |
||
333 | 333 | * @throws EE_Error |
334 | 334 | * @return bool |
335 | 335 | */ |
336 | - public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){ |
|
337 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
338 | - $file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : ''; |
|
339 | - $folder = EEH_File::remove_filename_from_filepath( $full_file_path ); |
|
340 | - if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
341 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
342 | - $msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path ); |
|
343 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path ); |
|
344 | - throw new EE_Error( $msg ); |
|
336 | + public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') { |
|
337 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
338 | + $file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : ''; |
|
339 | + $folder = EEH_File::remove_filename_from_filepath($full_file_path); |
|
340 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
341 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
342 | + $msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path); |
|
343 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
344 | + throw new EE_Error($msg); |
|
345 | 345 | } |
346 | 346 | return FALSE; |
347 | 347 | } |
348 | 348 | // load WP_Filesystem and set file permissions |
349 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
349 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
350 | 350 | // write the file |
351 | - if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) { |
|
352 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
353 | - $msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path ); |
|
354 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' ); |
|
355 | - throw new EE_Error( $msg ); |
|
351 | + if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) { |
|
352 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
353 | + $msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path); |
|
354 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f'); |
|
355 | + throw new EE_Error($msg); |
|
356 | 356 | } |
357 | 357 | return FALSE; |
358 | 358 | } |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * @param string $full_file_path |
369 | 369 | * @return bool |
370 | 370 | */ |
371 | - public static function exists( $full_file_path = '' ) { |
|
372 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
373 | - return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE; |
|
371 | + public static function exists($full_file_path = '') { |
|
372 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
373 | + return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE; |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | * @param string $full_file_path |
383 | 383 | * @return bool |
384 | 384 | */ |
385 | - public static function is_readable( $full_file_path = '' ) { |
|
386 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
387 | - if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) { |
|
385 | + public static function is_readable($full_file_path = '') { |
|
386 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
387 | + if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
388 | 388 | return true; |
389 | 389 | } else { |
390 | 390 | return false; |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | * @param string $full_file_path |
401 | 401 | * @return string |
402 | 402 | */ |
403 | - public static function remove_filename_from_filepath( $full_file_path = '' ) { |
|
404 | - return pathinfo( $full_file_path, PATHINFO_DIRNAME ); |
|
403 | + public static function remove_filename_from_filepath($full_file_path = '') { |
|
404 | + return pathinfo($full_file_path, PATHINFO_DIRNAME); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @param string $full_file_path |
412 | 412 | * @return string |
413 | 413 | */ |
414 | - public static function get_filename_from_filepath( $full_file_path = '' ) { |
|
415 | - return pathinfo( $full_file_path, PATHINFO_BASENAME ); |
|
414 | + public static function get_filename_from_filepath($full_file_path = '') { |
|
415 | + return pathinfo($full_file_path, PATHINFO_BASENAME); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | * @param string $full_file_path |
423 | 423 | * @return string |
424 | 424 | */ |
425 | - public static function get_file_extension( $full_file_path = '' ) { |
|
426 | - return pathinfo( $full_file_path, PATHINFO_EXTENSION ); |
|
425 | + public static function get_file_extension($full_file_path = '') { |
|
426 | + return pathinfo($full_file_path, PATHINFO_EXTENSION); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | |
@@ -434,15 +434,15 @@ discard block |
||
434 | 434 | * @param string $folder |
435 | 435 | * @return bool |
436 | 436 | */ |
437 | - public static function add_htaccess_deny_from_all( $folder = '' ) { |
|
438 | - $folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
|
439 | - if ( ! EEH_File::exists( $folder . '.htaccess' ) ) { |
|
440 | - if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) { |
|
437 | + public static function add_htaccess_deny_from_all($folder = '') { |
|
438 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
439 | + if ( ! EEH_File::exists($folder.'.htaccess')) { |
|
440 | + if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) { |
|
441 | 441 | return FALSE; |
442 | 442 | } |
443 | 443 | } |
444 | - if ( ! EEH_File::exists( $folder . 'index.html' ) ) { |
|
445 | - if ( ! EEH_File::write_to_file( $folder . 'index.html', 'cheating huh?', '.html' )) { |
|
444 | + if ( ! EEH_File::exists($folder.'index.html')) { |
|
445 | + if ( ! EEH_File::write_to_file($folder.'index.html', 'cheating huh?', '.html')) { |
|
446 | 446 | return FALSE; |
447 | 447 | } |
448 | 448 | } |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * @param string $file_path |
458 | 458 | * @return string |
459 | 459 | */ |
460 | - public static function get_classname_from_filepath_with_standard_filename( $file_path ){ |
|
460 | + public static function get_classname_from_filepath_with_standard_filename($file_path) { |
|
461 | 461 | //extract file from path |
462 | - $filename = basename( $file_path ); |
|
462 | + $filename = basename($file_path); |
|
463 | 463 | //now remove the first period and everything after |
464 | - $pos_of_first_period = strpos( $filename,'.' ); |
|
464 | + $pos_of_first_period = strpos($filename, '.'); |
|
465 | 465 | return substr($filename, 0, $pos_of_first_period); |
466 | 466 | } |
467 | 467 | |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | * @param string $file_path |
474 | 474 | * @return string |
475 | 475 | */ |
476 | - public static function standardise_directory_separators( $file_path ){ |
|
477 | - return str_replace( array( '\\', '/' ), DS, $file_path ); |
|
476 | + public static function standardise_directory_separators($file_path) { |
|
477 | + return str_replace(array('\\', '/'), DS, $file_path); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | * @param string $file_path |
486 | 486 | * @return string |
487 | 487 | */ |
488 | - public static function end_with_directory_separator( $file_path ){ |
|
489 | - return rtrim( $file_path, '/\\' ) . DS; |
|
488 | + public static function end_with_directory_separator($file_path) { |
|
489 | + return rtrim($file_path, '/\\').DS; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | |
@@ -496,8 +496,8 @@ discard block |
||
496 | 496 | * @param $file_path |
497 | 497 | * @return string |
498 | 498 | */ |
499 | - public static function standardise_and_end_with_directory_separator( $file_path ){ |
|
500 | - return self::end_with_directory_separator( self::standardise_directory_separators( $file_path )); |
|
499 | + public static function standardise_and_end_with_directory_separator($file_path) { |
|
500 | + return self::end_with_directory_separator(self::standardise_directory_separators($file_path)); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | |
@@ -514,21 +514,21 @@ discard block |
||
514 | 514 | * if $index_numerically == FALSE (Default) keys are what the class names SHOULD be; |
515 | 515 | * and values are their filepaths |
516 | 516 | */ |
517 | - public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){ |
|
517 | + public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) { |
|
518 | 518 | $class_to_folder_path = array(); |
519 | - foreach( $folder_paths as $folder_path ){ |
|
520 | - $folder_path = self::standardise_and_end_with_directory_separator( $folder_path ); |
|
519 | + foreach ($folder_paths as $folder_path) { |
|
520 | + $folder_path = self::standardise_and_end_with_directory_separator($folder_path); |
|
521 | 521 | // load WP_Filesystem and set file permissions |
522 | - $files_in_folder = glob( $folder_path . '*' ); |
|
522 | + $files_in_folder = glob($folder_path.'*'); |
|
523 | 523 | $class_to_folder_path = array(); |
524 | - if ( $files_in_folder ) { |
|
525 | - foreach( $files_in_folder as $file_path ){ |
|
524 | + if ($files_in_folder) { |
|
525 | + foreach ($files_in_folder as $file_path) { |
|
526 | 526 | //only add files, not folders |
527 | - if ( ! is_dir( $file_path )) { |
|
528 | - if ( $index_numerically ) { |
|
527 | + if ( ! is_dir($file_path)) { |
|
528 | + if ($index_numerically) { |
|
529 | 529 | $class_to_folder_path[] = $file_path; |
530 | 530 | } else { |
531 | - $classname = self::get_classname_from_filepath_with_standard_filename( $file_path ); |
|
531 | + $classname = self::get_classname_from_filepath_with_standard_filename($file_path); |
|
532 | 532 | $class_to_folder_path[$classname] = $file_path; |
533 | 533 | } |
534 | 534 | } |
@@ -548,39 +548,39 @@ discard block |
||
548 | 548 | * @return boolean success |
549 | 549 | * @throws EE_Error |
550 | 550 | */ |
551 | - public static function copy( $source_file, $destination_file, $overwrite = FALSE ){ |
|
552 | - $full_source_path = EEH_File::standardise_directory_separators( $source_file ); |
|
553 | - if( ! EEH_File::exists( $full_source_path ) ){ |
|
554 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
555 | - $msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path ); |
|
556 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path ); |
|
557 | - throw new EE_Error( $msg ); |
|
551 | + public static function copy($source_file, $destination_file, $overwrite = FALSE) { |
|
552 | + $full_source_path = EEH_File::standardise_directory_separators($source_file); |
|
553 | + if ( ! EEH_File::exists($full_source_path)) { |
|
554 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
555 | + $msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path); |
|
556 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path); |
|
557 | + throw new EE_Error($msg); |
|
558 | 558 | } |
559 | 559 | return FALSE; |
560 | 560 | } |
561 | 561 | |
562 | - $full_dest_path = EEH_File::standardise_directory_separators( $destination_file ); |
|
563 | - $folder = EEH_File::remove_filename_from_filepath( $full_dest_path ); |
|
564 | - if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
565 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
566 | - $msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path ); |
|
567 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path ); |
|
568 | - throw new EE_Error( $msg ); |
|
562 | + $full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
|
563 | + $folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
|
564 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
565 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
566 | + $msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path); |
|
567 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path); |
|
568 | + throw new EE_Error($msg); |
|
569 | 569 | } |
570 | 570 | return FALSE; |
571 | 571 | } |
572 | 572 | |
573 | 573 | // load WP_Filesystem and set file permissions |
574 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file ); |
|
574 | + $wp_filesystem = EEH_File::_get_wp_filesystem($destination_file); |
|
575 | 575 | // write the file |
576 | 576 | if ( ! $wp_filesystem->copy( |
577 | - EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ), |
|
578 | - EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ), |
|
577 | + EEH_File::convert_local_filepath_to_remote_filepath($full_source_path), |
|
578 | + EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path), |
|
579 | 579 | $overwrite )) { |
580 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
581 | - $msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path ); |
|
582 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' ); |
|
583 | - throw new EE_Error( $msg ); |
|
580 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
581 | + $msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path); |
|
582 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f'); |
|
583 | + throw new EE_Error($msg); |
|
584 | 584 | } |
585 | 585 | return FALSE; |
586 | 586 | } |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | * @param string $filepath |
593 | 593 | * @return boolean |
594 | 594 | */ |
595 | - public static function is_in_uploads_folder( $filepath ) { |
|
595 | + public static function is_in_uploads_folder($filepath) { |
|
596 | 596 | $uploads = wp_upload_dir(); |
597 | - return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false; |
|
597 | + return strpos($filepath, $uploads['basedir']) === 0 ? true : false; |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | /** |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | * @return string the remote filepath (eg the filepath the filesystem method, eg |
609 | 609 | * ftp or ssh, will use to access the folder |
610 | 610 | */ |
611 | - public static function convert_local_filepath_to_remote_filepath( $local_filepath ) { |
|
612 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath ); |
|
613 | - return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath ); |
|
611 | + public static function convert_local_filepath_to_remote_filepath($local_filepath) { |
|
612 | + $wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath); |
|
613 | + return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath); |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | // End of file EEH_File.helper.php |
@@ -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,30 +32,30 @@ 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 | //filters and action hooks here |
47 | - add_action('AHEE__admin_option_settings__template__before', array( $this, 'use_venue_and_staff_manager_settings'), 10 ); |
|
48 | - add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 ); |
|
49 | - add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 ); |
|
47 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'use_venue_and_staff_manager_settings'), 10); |
|
48 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
49 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - public function use_venue_and_staff_manager_settings( $template_args ) { |
|
56 | - $_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager'] ); |
|
57 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'use_venue_and_staff_manager_settings.template.php'; |
|
58 | - EEH_Template::display_template( $template, $_args ); |
|
55 | + public function use_venue_and_staff_manager_settings($template_args) { |
|
56 | + $_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager']); |
|
57 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'use_venue_and_staff_manager_settings.template.php'; |
|
58 | + EEH_Template::display_template($template, $_args); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param array $template_args |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function debug_logging_options( $template_args = array() ) { |
|
71 | + public function debug_logging_options($template_args = array()) { |
|
72 | 72 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
73 | - $template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE; |
|
74 | - $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 ) : ''; |
|
75 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
76 | - EEH_Template::display_template( $template, $template_args ); |
|
73 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE; |
|
74 | + $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) : ''; |
|
75 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
76 | + EEH_Template::display_template($template, $template_args); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | * @param array $admin_options |
85 | 85 | * @return array |
86 | 86 | */ |
87 | - public function update_debug_logging_options( $admin_options = array() ) { |
|
88 | - $use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging; |
|
87 | + public function update_debug_logging_options($admin_options = array()) { |
|
88 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
89 | 89 | $admin_options->use_full_logging = $use_full_logging; |
90 | 90 | |
91 | - if ( $use_full_logging === FALSE ) { |
|
92 | - EE_Error::get_notices( FALSE ); |
|
91 | + if ($use_full_logging === FALSE) { |
|
92 | + EE_Error::get_notices(FALSE); |
|
93 | 93 | EE_Error::reset_notices(); |
94 | 94 | } |
95 | 95 | |
96 | - $admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging; |
|
97 | - $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; |
|
96 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
97 | + $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; |
|
98 | 98 | return $admin_options; |
99 | 99 | } |
100 | 100 |