@@ -11,22 +11,22 @@ discard block |
||
11 | 11 | * @ version 4+ |
12 | 12 | */ |
13 | 13 | |
14 | - if ( have_posts() ) : ?> |
|
14 | + if (have_posts()) : ?> |
|
15 | 15 | |
16 | 16 | <header class="page-header"> |
17 | 17 | <h1 class="page-title"> |
18 | 18 | <?php |
19 | - if ( is_day() ) : |
|
20 | - printf( __( 'Today\'s Events: %s', 'event_espresso' ), get_the_date() ); |
|
19 | + if (is_day()) : |
|
20 | + printf(__('Today\'s Events: %s', 'event_espresso'), get_the_date()); |
|
21 | 21 | |
22 | - elseif ( is_month() ) : |
|
23 | - printf( __( 'Events This Month: %s', 'event_espresso' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'event_espresso' ) ) ); |
|
22 | + elseif (is_month()) : |
|
23 | + printf(__('Events This Month: %s', 'event_espresso'), get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso'))); |
|
24 | 24 | |
25 | - elseif ( is_year() ) : |
|
26 | - printf( __( 'Events This Year: %s', 'event_espresso' ), get_the_date( _x( 'Y', 'yearly archives date format', 'event_espresso' ) ) ); |
|
25 | + elseif (is_year()) : |
|
26 | + printf(__('Events This Year: %s', 'event_espresso'), get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))); |
|
27 | 27 | |
28 | 28 | else : |
29 | - echo apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
29 | + echo apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
30 | 30 | |
31 | 31 | endif; |
32 | 32 | ?> |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | |
37 | 37 | <?php |
38 | 38 | // allow other stuff |
39 | - do_action( 'AHEE__archive_espresso_events_template__before_loop' ); |
|
39 | + do_action('AHEE__archive_espresso_events_template__before_loop'); |
|
40 | 40 | // Start the Loop. |
41 | - while ( have_posts() ) : the_post(); |
|
41 | + while (have_posts()) : the_post(); |
|
42 | 42 | // Include the post TYPE-specific template for the content. |
43 | - espresso_get_template_part( 'content', 'espresso_events-shortcode' ); |
|
43 | + espresso_get_template_part('content', 'espresso_events-shortcode'); |
|
44 | 44 | endwhile; |
45 | 45 | // Previous/next page navigation. |
46 | 46 | espresso_pagination(); |
47 | 47 | // allow moar other stuff |
48 | - do_action( 'AHEE__archive_espresso_events_template__after_loop' ); |
|
48 | + do_action('AHEE__archive_espresso_events_template__after_loop'); |
|
49 | 49 | |
50 | 50 | else : |
51 | 51 | // If no content, include the "No posts found" template. |
52 | - espresso_get_template_part( 'content', 'none' ); |
|
52 | + espresso_get_template_part('content', 'none'); |
|
53 | 53 | |
54 | 54 | endif; |
55 | 55 |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 | 28 | */ |
29 | 29 | /** |
30 | - * Event Espresso |
|
31 | - * |
|
32 | - * Event Registration and Management Plugin for WordPress |
|
33 | - * |
|
34 | - * @package Event Espresso |
|
35 | - * @author Seth Shoultes |
|
36 | - * @copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
37 | - * @license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
38 | - * @link {@link http://www.eventespresso.com} |
|
39 | - * @since 4.0 |
|
40 | - * |
|
41 | - */ |
|
30 | + * Event Espresso |
|
31 | + * |
|
32 | + * Event Registration and Management Plugin for WordPress |
|
33 | + * |
|
34 | + * @package Event Espresso |
|
35 | + * @author Seth Shoultes |
|
36 | + * @copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
37 | + * @license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
38 | + * @link {@link http://www.eventespresso.com} |
|
39 | + * @since 4.0 |
|
40 | + * |
|
41 | + */ |
|
42 | 42 | |
43 | 43 | if ( function_exists( 'espresso_version' ) ) { |
44 | 44 | |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | |
236 | 236 | if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
237 | 237 | /** |
238 | - * deactivate_plugin |
|
239 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | - * |
|
241 | - * @access public |
|
242 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | - * @return void |
|
244 | - */ |
|
238 | + * deactivate_plugin |
|
239 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | + * |
|
241 | + * @access public |
|
242 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | + * @return void |
|
244 | + */ |
|
245 | 245 | function espresso_deactivate_plugin( $plugin_basename = '' ) { |
246 | 246 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
247 | 247 | require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
@@ -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 |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public $map_settings = null; |
90 | 90 | |
91 | 91 | /** |
92 | - * |
|
93 | - * @deprecated |
|
94 | - * @var EE_Gateway_Config |
|
95 | - */ |
|
92 | + * |
|
93 | + * @deprecated |
|
94 | + * @var EE_Gateway_Config |
|
95 | + */ |
|
96 | 96 | public $gateway = null; |
97 | 97 | |
98 | 98 | /** |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | /** |
584 | 584 | * update_config |
585 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
585 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
586 | 586 | * |
587 | 587 | * @access public |
588 | 588 | * @param string $section |
@@ -1606,51 +1606,51 @@ discard block |
||
1606 | 1606 | class EE_Organization_Config extends EE_Config_Base { |
1607 | 1607 | |
1608 | 1608 | /** |
1609 | - * @var string $name |
|
1610 | - * eg EE4.1 |
|
1611 | - */ |
|
1609 | + * @var string $name |
|
1610 | + * eg EE4.1 |
|
1611 | + */ |
|
1612 | 1612 | public $name; |
1613 | 1613 | |
1614 | 1614 | /** |
1615 | - * @var string $address_1 |
|
1616 | - * eg 123 Onna Road |
|
1617 | - */ |
|
1615 | + * @var string $address_1 |
|
1616 | + * eg 123 Onna Road |
|
1617 | + */ |
|
1618 | 1618 | public $address_1; |
1619 | 1619 | |
1620 | 1620 | /** |
1621 | - * @var string $address_2 |
|
1622 | - * eg PO Box 123 |
|
1623 | - */ |
|
1621 | + * @var string $address_2 |
|
1622 | + * eg PO Box 123 |
|
1623 | + */ |
|
1624 | 1624 | public $address_2; |
1625 | 1625 | |
1626 | 1626 | /** |
1627 | - * @var string $city |
|
1628 | - * eg Inna City |
|
1629 | - */ |
|
1627 | + * @var string $city |
|
1628 | + * eg Inna City |
|
1629 | + */ |
|
1630 | 1630 | public $city; |
1631 | 1631 | |
1632 | 1632 | /** |
1633 | - * @var int $STA_ID |
|
1634 | - * eg 4 |
|
1635 | - */ |
|
1633 | + * @var int $STA_ID |
|
1634 | + * eg 4 |
|
1635 | + */ |
|
1636 | 1636 | public $STA_ID; |
1637 | 1637 | |
1638 | 1638 | /** |
1639 | - * @var string $CNT_ISO |
|
1640 | - * eg US |
|
1641 | - */ |
|
1639 | + * @var string $CNT_ISO |
|
1640 | + * eg US |
|
1641 | + */ |
|
1642 | 1642 | public $CNT_ISO; |
1643 | 1643 | |
1644 | 1644 | /** |
1645 | - * @var string $zip |
|
1646 | - * eg 12345 or V1A 2B3 |
|
1647 | - */ |
|
1645 | + * @var string $zip |
|
1646 | + * eg 12345 or V1A 2B3 |
|
1647 | + */ |
|
1648 | 1648 | public $zip; |
1649 | 1649 | |
1650 | 1650 | /** |
1651 | - * @var string $email |
|
1652 | - * eg [email protected] |
|
1653 | - */ |
|
1651 | + * @var string $email |
|
1652 | + * eg [email protected] |
|
1653 | + */ |
|
1654 | 1654 | public $email; |
1655 | 1655 | |
1656 | 1656 | |
@@ -1669,9 +1669,9 @@ discard block |
||
1669 | 1669 | public $vat; |
1670 | 1670 | |
1671 | 1671 | /** |
1672 | - * @var string $logo_url |
|
1673 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | - */ |
|
1672 | + * @var string $logo_url |
|
1673 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | + */ |
|
1675 | 1675 | public $logo_url; |
1676 | 1676 | |
1677 | 1677 | |
@@ -1765,55 +1765,55 @@ discard block |
||
1765 | 1765 | class EE_Currency_Config extends EE_Config_Base { |
1766 | 1766 | |
1767 | 1767 | /** |
1768 | - * @var string $code |
|
1769 | - * eg 'US' |
|
1770 | - */ |
|
1768 | + * @var string $code |
|
1769 | + * eg 'US' |
|
1770 | + */ |
|
1771 | 1771 | public $code; |
1772 | 1772 | |
1773 | 1773 | /** |
1774 | - * @var string $name |
|
1775 | - * eg 'Dollar' |
|
1776 | - */ |
|
1774 | + * @var string $name |
|
1775 | + * eg 'Dollar' |
|
1776 | + */ |
|
1777 | 1777 | public $name; |
1778 | 1778 | |
1779 | 1779 | /** |
1780 | - * plural name |
|
1781 | - * @var string $plural |
|
1782 | - * eg 'Dollars' |
|
1783 | - */ |
|
1780 | + * plural name |
|
1781 | + * @var string $plural |
|
1782 | + * eg 'Dollars' |
|
1783 | + */ |
|
1784 | 1784 | public $plural; |
1785 | 1785 | |
1786 | 1786 | /** |
1787 | - * currency sign |
|
1788 | - * @var string $sign |
|
1789 | - * eg '$' |
|
1790 | - */ |
|
1787 | + * currency sign |
|
1788 | + * @var string $sign |
|
1789 | + * eg '$' |
|
1790 | + */ |
|
1791 | 1791 | public $sign; |
1792 | 1792 | |
1793 | 1793 | /** |
1794 | - * Whether the currency sign should come before the number or not |
|
1795 | - * @var boolean $sign_b4 |
|
1796 | - */ |
|
1794 | + * Whether the currency sign should come before the number or not |
|
1795 | + * @var boolean $sign_b4 |
|
1796 | + */ |
|
1797 | 1797 | public $sign_b4; |
1798 | 1798 | |
1799 | 1799 | /** |
1800 | - * How many digits should come after the decimal place |
|
1801 | - * @var int $dec_plc |
|
1802 | - */ |
|
1800 | + * How many digits should come after the decimal place |
|
1801 | + * @var int $dec_plc |
|
1802 | + */ |
|
1803 | 1803 | public $dec_plc; |
1804 | 1804 | |
1805 | 1805 | /** |
1806 | - * Symbol to use for decimal mark |
|
1807 | - * @var string $dec_mrk |
|
1808 | - * eg '.' |
|
1809 | - */ |
|
1806 | + * Symbol to use for decimal mark |
|
1807 | + * @var string $dec_mrk |
|
1808 | + * eg '.' |
|
1809 | + */ |
|
1810 | 1810 | public $dec_mrk; |
1811 | 1811 | |
1812 | 1812 | /** |
1813 | - * Symbol to use for thousands |
|
1814 | - * @var string $thsnds |
|
1815 | - * eg ',' |
|
1816 | - */ |
|
1813 | + * Symbol to use for thousands |
|
1814 | + * @var string $thsnds |
|
1815 | + * eg ',' |
|
1816 | + */ |
|
1817 | 1817 | public $thsnds; |
1818 | 1818 | |
1819 | 1819 | |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | * whether or not to show alternate payment options during the reg process if payment status is pending |
1882 | 1882 | * @var boolean $show_pending_payment_options |
1883 | 1883 | */ |
1884 | - public $show_pending_payment_options; |
|
1884 | + public $show_pending_payment_options; |
|
1885 | 1885 | |
1886 | 1886 | /** |
1887 | 1887 | * Whether to skip the registration confirmation page |
1888 | 1888 | * @var boolean $skip_reg_confirmation |
1889 | 1889 | */ |
1890 | - public $skip_reg_confirmation; |
|
1890 | + public $skip_reg_confirmation; |
|
1891 | 1891 | |
1892 | 1892 | /** |
1893 | 1893 | * an array of SPCO reg steps where: |
@@ -1898,64 +1898,64 @@ discard block |
||
1898 | 1898 | * "slug" => the URL param used to trigger the reg step |
1899 | 1899 | * @var array $reg_steps |
1900 | 1900 | */ |
1901 | - public $reg_steps; |
|
1901 | + public $reg_steps; |
|
1902 | 1902 | |
1903 | 1903 | /** |
1904 | 1904 | * Whether registration confirmation should be the last page of SPCO |
1905 | 1905 | * @var boolean $reg_confirmation_last |
1906 | 1906 | */ |
1907 | - public $reg_confirmation_last; |
|
1907 | + public $reg_confirmation_last; |
|
1908 | 1908 | |
1909 | 1909 | /** |
1910 | 1910 | * Whether or not to enable the EE Bot Trap |
1911 | 1911 | * @var boolean $use_bot_trap |
1912 | 1912 | */ |
1913 | - public $use_bot_trap; |
|
1913 | + public $use_bot_trap; |
|
1914 | 1914 | |
1915 | 1915 | /** |
1916 | 1916 | * Whether or not to encrypt some data sent by the EE Bot Trap |
1917 | 1917 | * @var boolean $use_encryption |
1918 | 1918 | */ |
1919 | - public $use_encryption; |
|
1919 | + public $use_encryption; |
|
1920 | 1920 | |
1921 | 1921 | /** |
1922 | 1922 | * Whether or not to use ReCaptcha |
1923 | 1923 | * @var boolean $use_captcha |
1924 | 1924 | */ |
1925 | - public $use_captcha; |
|
1925 | + public $use_captcha; |
|
1926 | 1926 | |
1927 | 1927 | /** |
1928 | 1928 | * ReCaptcha Theme |
1929 | 1929 | * @var string $recaptcha_theme |
1930 | 1930 | * options: 'dark ', 'light' |
1931 | 1931 | */ |
1932 | - public $recaptcha_theme; |
|
1932 | + public $recaptcha_theme; |
|
1933 | 1933 | |
1934 | 1934 | /** |
1935 | 1935 | * ReCaptcha Type |
1936 | 1936 | * @var string $recaptcha_type |
1937 | 1937 | * options: 'audio', 'image' |
1938 | 1938 | */ |
1939 | - public $recaptcha_type; |
|
1939 | + public $recaptcha_type; |
|
1940 | 1940 | |
1941 | 1941 | /** |
1942 | 1942 | * ReCaptcha language |
1943 | 1943 | * @var string $recaptcha_language |
1944 | 1944 | * eg 'en' |
1945 | 1945 | */ |
1946 | - public $recaptcha_language; |
|
1946 | + public $recaptcha_language; |
|
1947 | 1947 | |
1948 | 1948 | /** |
1949 | 1949 | * ReCaptcha public key |
1950 | 1950 | * @var string $recaptcha_publickey |
1951 | 1951 | */ |
1952 | - public $recaptcha_publickey; |
|
1952 | + public $recaptcha_publickey; |
|
1953 | 1953 | |
1954 | 1954 | /** |
1955 | 1955 | * ReCaptcha private key |
1956 | 1956 | * @var string $recaptcha_privatekey |
1957 | 1957 | */ |
1958 | - public $recaptcha_privatekey; |
|
1958 | + public $recaptcha_privatekey; |
|
1959 | 1959 | |
1960 | 1960 | /** |
1961 | 1961 | * ReCaptcha width |
@@ -2021,58 +2021,58 @@ discard block |
||
2021 | 2021 | class EE_Admin_Config extends EE_Config_Base { |
2022 | 2022 | |
2023 | 2023 | /** |
2024 | - * @var boolean $use_personnel_manager |
|
2025 | - */ |
|
2024 | + * @var boolean $use_personnel_manager |
|
2025 | + */ |
|
2026 | 2026 | public $use_personnel_manager; |
2027 | 2027 | |
2028 | 2028 | /** |
2029 | - * @var boolean $use_dashboard_widget |
|
2030 | - */ |
|
2029 | + * @var boolean $use_dashboard_widget |
|
2030 | + */ |
|
2031 | 2031 | public $use_dashboard_widget; |
2032 | 2032 | |
2033 | 2033 | /** |
2034 | - * @var int $events_in_dashboard |
|
2035 | - */ |
|
2034 | + * @var int $events_in_dashboard |
|
2035 | + */ |
|
2036 | 2036 | public $events_in_dashboard; |
2037 | 2037 | |
2038 | 2038 | /** |
2039 | - * @var boolean $use_event_timezones |
|
2040 | - */ |
|
2039 | + * @var boolean $use_event_timezones |
|
2040 | + */ |
|
2041 | 2041 | public $use_event_timezones; |
2042 | 2042 | |
2043 | 2043 | /** |
2044 | - * @var boolean $use_full_logging |
|
2045 | - */ |
|
2044 | + * @var boolean $use_full_logging |
|
2045 | + */ |
|
2046 | 2046 | public $use_full_logging; |
2047 | 2047 | |
2048 | 2048 | /** |
2049 | - * @var string $log_file_name |
|
2050 | - */ |
|
2049 | + * @var string $log_file_name |
|
2050 | + */ |
|
2051 | 2051 | public $log_file_name; |
2052 | 2052 | |
2053 | 2053 | /** |
2054 | - * @var string $debug_file_name |
|
2055 | - */ |
|
2054 | + * @var string $debug_file_name |
|
2055 | + */ |
|
2056 | 2056 | public $debug_file_name; |
2057 | 2057 | |
2058 | 2058 | /** |
2059 | - * @var boolean $use_remote_logging |
|
2060 | - */ |
|
2059 | + * @var boolean $use_remote_logging |
|
2060 | + */ |
|
2061 | 2061 | public $use_remote_logging; |
2062 | 2062 | |
2063 | 2063 | /** |
2064 | - * @var string $remote_logging_url |
|
2065 | - */ |
|
2064 | + * @var string $remote_logging_url |
|
2065 | + */ |
|
2066 | 2066 | public $remote_logging_url; |
2067 | 2067 | |
2068 | 2068 | /** |
2069 | - * @var boolean $show_reg_footer |
|
2070 | - */ |
|
2069 | + * @var boolean $show_reg_footer |
|
2070 | + */ |
|
2071 | 2071 | public $show_reg_footer; |
2072 | 2072 | |
2073 | 2073 | /** |
2074 | - * @var string $affiliate_id |
|
2075 | - */ |
|
2074 | + * @var string $affiliate_id |
|
2075 | + */ |
|
2076 | 2076 | public $affiliate_id; |
2077 | 2077 | |
2078 | 2078 | |
@@ -2146,43 +2146,43 @@ discard block |
||
2146 | 2146 | class EE_Template_Config extends EE_Config_Base { |
2147 | 2147 | |
2148 | 2148 | /** |
2149 | - * @var boolean $enable_default_style |
|
2150 | - */ |
|
2149 | + * @var boolean $enable_default_style |
|
2150 | + */ |
|
2151 | 2151 | public $enable_default_style; |
2152 | 2152 | |
2153 | 2153 | /** |
2154 | - * @var string $custom_style_sheet |
|
2155 | - */ |
|
2154 | + * @var string $custom_style_sheet |
|
2155 | + */ |
|
2156 | 2156 | public $custom_style_sheet; |
2157 | 2157 | |
2158 | 2158 | /** |
2159 | - * @var boolean $display_address_in_regform |
|
2160 | - */ |
|
2159 | + * @var boolean $display_address_in_regform |
|
2160 | + */ |
|
2161 | 2161 | public $display_address_in_regform; |
2162 | 2162 | |
2163 | 2163 | /** |
2164 | - * @var int $display_description_on_multi_reg_page |
|
2165 | - */ |
|
2164 | + * @var int $display_description_on_multi_reg_page |
|
2165 | + */ |
|
2166 | 2166 | public $display_description_on_multi_reg_page; |
2167 | 2167 | |
2168 | 2168 | /** |
2169 | - * @var boolean $use_custom_templates |
|
2170 | - */ |
|
2169 | + * @var boolean $use_custom_templates |
|
2170 | + */ |
|
2171 | 2171 | public $use_custom_templates; |
2172 | 2172 | |
2173 | 2173 | /** |
2174 | - * @var string $current_espresso_theme |
|
2175 | - */ |
|
2174 | + * @var string $current_espresso_theme |
|
2175 | + */ |
|
2176 | 2176 | public $current_espresso_theme; |
2177 | 2177 | |
2178 | 2178 | /** |
2179 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | - */ |
|
2179 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | + */ |
|
2181 | 2181 | public $EED_Event_Single; |
2182 | 2182 | |
2183 | 2183 | /** |
2184 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | - */ |
|
2184 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | + */ |
|
2186 | 2186 | public $EED_Events_Archive; |
2187 | 2187 | |
2188 | 2188 | |
@@ -2215,78 +2215,78 @@ discard block |
||
2215 | 2215 | class EE_Map_Config extends EE_Config_Base { |
2216 | 2216 | |
2217 | 2217 | /** |
2218 | - * @var boolean $use_google_maps |
|
2219 | - */ |
|
2218 | + * @var boolean $use_google_maps |
|
2219 | + */ |
|
2220 | 2220 | public $use_google_maps; |
2221 | 2221 | |
2222 | 2222 | /** |
2223 | - * @var int $event_details_map_width |
|
2224 | - */ |
|
2223 | + * @var int $event_details_map_width |
|
2224 | + */ |
|
2225 | 2225 | public $event_details_map_width; |
2226 | 2226 | |
2227 | 2227 | /** |
2228 | - * @var int $event_details_map_height |
|
2229 | - */ |
|
2228 | + * @var int $event_details_map_height |
|
2229 | + */ |
|
2230 | 2230 | public $event_details_map_height; |
2231 | 2231 | |
2232 | 2232 | /** |
2233 | - * @var int $event_details_map_zoom |
|
2234 | - */ |
|
2233 | + * @var int $event_details_map_zoom |
|
2234 | + */ |
|
2235 | 2235 | public $event_details_map_zoom; |
2236 | 2236 | |
2237 | 2237 | /** |
2238 | - * @var boolean $event_details_display_nav |
|
2239 | - */ |
|
2238 | + * @var boolean $event_details_display_nav |
|
2239 | + */ |
|
2240 | 2240 | public $event_details_display_nav; |
2241 | 2241 | |
2242 | 2242 | /** |
2243 | - * @var boolean $event_details_nav_size |
|
2244 | - */ |
|
2243 | + * @var boolean $event_details_nav_size |
|
2244 | + */ |
|
2245 | 2245 | public $event_details_nav_size; |
2246 | 2246 | |
2247 | 2247 | /** |
2248 | - * @var string $event_details_control_type |
|
2249 | - */ |
|
2248 | + * @var string $event_details_control_type |
|
2249 | + */ |
|
2250 | 2250 | public $event_details_control_type; |
2251 | 2251 | |
2252 | 2252 | /** |
2253 | - * @var string $event_details_map_align |
|
2254 | - */ |
|
2253 | + * @var string $event_details_map_align |
|
2254 | + */ |
|
2255 | 2255 | public $event_details_map_align; |
2256 | 2256 | |
2257 | 2257 | /** |
2258 | - * @var int $event_list_map_width |
|
2259 | - */ |
|
2258 | + * @var int $event_list_map_width |
|
2259 | + */ |
|
2260 | 2260 | public $event_list_map_width; |
2261 | 2261 | |
2262 | 2262 | /** |
2263 | - * @var int $event_list_map_height |
|
2264 | - */ |
|
2263 | + * @var int $event_list_map_height |
|
2264 | + */ |
|
2265 | 2265 | public $event_list_map_height; |
2266 | 2266 | |
2267 | 2267 | /** |
2268 | - * @var int $event_list_map_zoom |
|
2269 | - */ |
|
2268 | + * @var int $event_list_map_zoom |
|
2269 | + */ |
|
2270 | 2270 | public $event_list_map_zoom; |
2271 | 2271 | |
2272 | 2272 | /** |
2273 | - * @var boolean $event_list_display_nav |
|
2274 | - */ |
|
2273 | + * @var boolean $event_list_display_nav |
|
2274 | + */ |
|
2275 | 2275 | public $event_list_display_nav; |
2276 | 2276 | |
2277 | 2277 | /** |
2278 | - * @var boolean $event_list_nav_size |
|
2279 | - */ |
|
2278 | + * @var boolean $event_list_nav_size |
|
2279 | + */ |
|
2280 | 2280 | public $event_list_nav_size; |
2281 | 2281 | |
2282 | 2282 | /** |
2283 | - * @var string $event_list_control_type |
|
2284 | - */ |
|
2283 | + * @var string $event_list_control_type |
|
2284 | + */ |
|
2285 | 2285 | public $event_list_control_type; |
2286 | 2286 | |
2287 | 2287 | /** |
2288 | - * @var string $event_list_map_align |
|
2289 | - */ |
|
2288 | + * @var string $event_list_map_align |
|
2289 | + */ |
|
2290 | 2290 | public $event_list_map_align; |
2291 | 2291 | |
2292 | 2292 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->$config->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->$config->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->$addon_name = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -881,11 +881,11 @@ discard block |
||
881 | 881 | * @return void |
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
884 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
885 | 885 | return; |
886 | 886 | } |
887 | 887 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
888 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
888 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
889 | 889 | // allow modules to set hooks for the rest of the system |
890 | 890 | EE_Registry::instance()->modules = $this->_register_modules(); |
891 | 891 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @return void |
900 | 900 | */ |
901 | 901 | public function initialize_shortcodes_and_modules() { |
902 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
902 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
903 | 903 | return; |
904 | 904 | } |
905 | 905 | // allow shortcodes to set hooks for the rest of the system |
@@ -918,26 +918,26 @@ discard block |
||
918 | 918 | * @return void |
919 | 919 | */ |
920 | 920 | public function widgets_init() { |
921 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
921 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | //only init widgets on admin pages when not in complete maintenance, and |
925 | 925 | //on frontend when not in any maintenance mode |
926 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
926 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
927 | 927 | // grab list of installed widgets |
928 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
928 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
929 | 929 | // filter list of modules to register |
930 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
930 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
931 | 931 | |
932 | - if ( ! empty( $widgets_to_register ) ) { |
|
932 | + if ( ! empty($widgets_to_register)) { |
|
933 | 933 | // cycle thru widget folders |
934 | - foreach ( $widgets_to_register as $widget_path ) { |
|
934 | + foreach ($widgets_to_register as $widget_path) { |
|
935 | 935 | // add to list of installed widget modules |
936 | - EE_Config::register_ee_widget( $widget_path ); |
|
936 | + EE_Config::register_ee_widget($widget_path); |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | // filter list of installed modules |
940 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
940 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
@@ -950,54 +950,54 @@ discard block |
||
950 | 950 | * @param string $widget_path - full path up to and including widget folder |
951 | 951 | * @return void |
952 | 952 | */ |
953 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
954 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
953 | + public static function register_ee_widget($widget_path = NULL) { |
|
954 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
955 | 955 | $widget_ext = '.widget.php'; |
956 | 956 | // make all separators match |
957 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
957 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
958 | 958 | // does the file path INCLUDE the actual file name as part of the path ? |
959 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
959 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
960 | 960 | // grab and shortcode file name from directory name and break apart at dots |
961 | - $file_name = explode( '.', basename( $widget_path )); |
|
961 | + $file_name = explode('.', basename($widget_path)); |
|
962 | 962 | // take first segment from file name pieces and remove class prefix if it exists |
963 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
963 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
964 | 964 | // sanitize shortcode directory name |
965 | - $widget = sanitize_key( $widget ); |
|
965 | + $widget = sanitize_key($widget); |
|
966 | 966 | // now we need to rebuild the shortcode path |
967 | - $widget_path = explode( DS, $widget_path ); |
|
967 | + $widget_path = explode(DS, $widget_path); |
|
968 | 968 | // remove last segment |
969 | - array_pop( $widget_path ); |
|
969 | + array_pop($widget_path); |
|
970 | 970 | // glue it back together |
971 | - $widget_path = implode( DS, $widget_path ); |
|
971 | + $widget_path = implode(DS, $widget_path); |
|
972 | 972 | } else { |
973 | 973 | // grab and sanitize widget directory name |
974 | - $widget = sanitize_key( basename( $widget_path )); |
|
974 | + $widget = sanitize_key(basename($widget_path)); |
|
975 | 975 | } |
976 | 976 | // create classname from widget directory name |
977 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
977 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
978 | 978 | // add class prefix |
979 | - $widget_class = 'EEW_' . $widget; |
|
979 | + $widget_class = 'EEW_'.$widget; |
|
980 | 980 | // does the widget exist ? |
981 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
981 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
982 | 982 | $msg = sprintf( |
983 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
983 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
984 | 984 | $widget_class, |
985 | - $widget_path . DS . $widget_class . $widget_ext |
|
985 | + $widget_path.DS.$widget_class.$widget_ext |
|
986 | 986 | ); |
987 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
987 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
988 | 988 | return; |
989 | 989 | } |
990 | 990 | // load the widget class file |
991 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
991 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
992 | 992 | // verify that class exists |
993 | - if ( ! class_exists( $widget_class )) { |
|
994 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
995 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
993 | + if ( ! class_exists($widget_class)) { |
|
994 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
995 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return; |
997 | 997 | } |
998 | - register_widget( $widget_class ); |
|
998 | + register_widget($widget_class); |
|
999 | 999 | // add to array of registered widgets |
1000 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
1000 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1010,18 +1010,18 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | private function _register_shortcodes() { |
1012 | 1012 | // grab list of installed shortcodes |
1013 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1013 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1014 | 1014 | // filter list of modules to register |
1015 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1016 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1015 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1016 | + if ( ! empty($shortcodes_to_register)) { |
|
1017 | 1017 | // cycle thru shortcode folders |
1018 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1018 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1019 | 1019 | // add to list of installed shortcode modules |
1020 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1020 | + EE_Config::register_shortcode($shortcode_path); |
|
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | // filter list of installed modules |
1024 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1024 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1033,56 +1033,56 @@ discard block |
||
1033 | 1033 | * @param string $shortcode_path - full path up to and including shortcode folder |
1034 | 1034 | * @return bool |
1035 | 1035 | */ |
1036 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1037 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1036 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1037 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1038 | 1038 | $shortcode_ext = '.shortcode.php'; |
1039 | 1039 | // make all separators match |
1040 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1040 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1041 | 1041 | // does the file path INCLUDE the actual file name as part of the path ? |
1042 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1042 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1043 | 1043 | // grab shortcode file name from directory name and break apart at dots |
1044 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1044 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1045 | 1045 | // take first segment from file name pieces and remove class prefix if it exists |
1046 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1046 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1047 | 1047 | // sanitize shortcode directory name |
1048 | - $shortcode = sanitize_key( $shortcode ); |
|
1048 | + $shortcode = sanitize_key($shortcode); |
|
1049 | 1049 | // now we need to rebuild the shortcode path |
1050 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1050 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1051 | 1051 | // remove last segment |
1052 | - array_pop( $shortcode_path ); |
|
1052 | + array_pop($shortcode_path); |
|
1053 | 1053 | // glue it back together |
1054 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1054 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1055 | 1055 | } else { |
1056 | 1056 | // we need to generate the filename based off of the folder name |
1057 | 1057 | // grab and sanitize shortcode directory name |
1058 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1059 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1058 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1059 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1060 | 1060 | } |
1061 | 1061 | // create classname from shortcode directory or file name |
1062 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1062 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1063 | 1063 | // add class prefix |
1064 | - $shortcode_class = 'EES_' . $shortcode; |
|
1064 | + $shortcode_class = 'EES_'.$shortcode; |
|
1065 | 1065 | // does the shortcode exist ? |
1066 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1066 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1067 | 1067 | $msg = sprintf( |
1068 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1068 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1069 | 1069 | $shortcode_class, |
1070 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1070 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1071 | 1071 | ); |
1072 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1072 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1073 | 1073 | return FALSE; |
1074 | 1074 | } |
1075 | 1075 | // load the shortcode class file |
1076 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1076 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1077 | 1077 | // verify that class exists |
1078 | - if ( ! class_exists( $shortcode_class )) { |
|
1079 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1080 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1078 | + if ( ! class_exists($shortcode_class)) { |
|
1079 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1080 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1081 | 1081 | return FALSE; |
1082 | 1082 | } |
1083 | - $shortcode = strtoupper( $shortcode ); |
|
1083 | + $shortcode = strtoupper($shortcode); |
|
1084 | 1084 | // add to array of registered shortcodes |
1085 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1085 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1086 | 1086 | return TRUE; |
1087 | 1087 | } |
1088 | 1088 | |
@@ -1097,23 +1097,23 @@ discard block |
||
1097 | 1097 | */ |
1098 | 1098 | private function _register_modules() { |
1099 | 1099 | // grab list of installed modules |
1100 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1100 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1101 | 1101 | // filter list of modules to register |
1102 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1102 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1103 | 1103 | |
1104 | 1104 | |
1105 | - if ( ! empty( $modules_to_register ) ) { |
|
1105 | + if ( ! empty($modules_to_register)) { |
|
1106 | 1106 | // loop through folders |
1107 | - foreach ( $modules_to_register as $module_path ) { |
|
1107 | + foreach ($modules_to_register as $module_path) { |
|
1108 | 1108 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1109 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1109 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1110 | 1110 | // add to list of installed modules |
1111 | - EE_Config::register_module( $module_path ); |
|
1111 | + EE_Config::register_module($module_path); |
|
1112 | 1112 | } |
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | // filter list of installed modules |
1116 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1116 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1126,54 +1126,54 @@ discard block |
||
1126 | 1126 | * @param string $module_path - full path up to and including module folder |
1127 | 1127 | * @return bool |
1128 | 1128 | */ |
1129 | - public static function register_module( $module_path = NULL ) { |
|
1130 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1129 | + public static function register_module($module_path = NULL) { |
|
1130 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1131 | 1131 | $module_ext = '.module.php'; |
1132 | 1132 | // make all separators match |
1133 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1133 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1134 | 1134 | // does the file path INCLUDE the actual file name as part of the path ? |
1135 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1135 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1136 | 1136 | // grab and shortcode file name from directory name and break apart at dots |
1137 | - $module_file = explode( '.', basename( $module_path )); |
|
1137 | + $module_file = explode('.', basename($module_path)); |
|
1138 | 1138 | // now we need to rebuild the shortcode path |
1139 | - $module_path = explode( DS, $module_path ); |
|
1139 | + $module_path = explode(DS, $module_path); |
|
1140 | 1140 | // remove last segment |
1141 | - array_pop( $module_path ); |
|
1141 | + array_pop($module_path); |
|
1142 | 1142 | // glue it back together |
1143 | - $module_path = implode( DS, $module_path ) . DS; |
|
1143 | + $module_path = implode(DS, $module_path).DS; |
|
1144 | 1144 | // take first segment from file name pieces and sanitize it |
1145 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1145 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1146 | 1146 | // ensure class prefix is added |
1147 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1147 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1148 | 1148 | } else { |
1149 | 1149 | // we need to generate the filename based off of the folder name |
1150 | 1150 | // grab and sanitize module name |
1151 | - $module = strtolower( basename( $module_path )); |
|
1152 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1151 | + $module = strtolower(basename($module_path)); |
|
1152 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1153 | 1153 | // like trailingslashit() |
1154 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1154 | + $module_path = rtrim($module_path, DS).DS; |
|
1155 | 1155 | // create classname from module directory name |
1156 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1156 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1157 | 1157 | // add class prefix |
1158 | - $module_class = 'EED_' . $module; |
|
1158 | + $module_class = 'EED_'.$module; |
|
1159 | 1159 | } |
1160 | 1160 | // does the module exist ? |
1161 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1162 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1163 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1161 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1162 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1163 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1164 | 1164 | return FALSE; |
1165 | 1165 | } |
1166 | 1166 | // load the module class file |
1167 | - require_once( $module_path . $module_class . $module_ext ); |
|
1167 | + require_once($module_path.$module_class.$module_ext); |
|
1168 | 1168 | // verify that class exists |
1169 | - if ( ! class_exists( $module_class )) { |
|
1170 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1171 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + if ( ! class_exists($module_class)) { |
|
1170 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1171 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1172 | 1172 | return FALSE; |
1173 | 1173 | } |
1174 | 1174 | // add to array of registered modules |
1175 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
1176 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
1175 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
1176 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
1177 | 1177 | return TRUE; |
1178 | 1178 | } |
1179 | 1179 | |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | */ |
1188 | 1188 | private function _initialize_shortcodes() { |
1189 | 1189 | // cycle thru shortcode folders |
1190 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1190 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1191 | 1191 | // add class prefix |
1192 | - $shortcode_class = 'EES_' . $shortcode; |
|
1192 | + $shortcode_class = 'EES_'.$shortcode; |
|
1193 | 1193 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1194 | 1194 | // which set hooks ? |
1195 | - if ( is_admin() ) { |
|
1195 | + if (is_admin()) { |
|
1196 | 1196 | // fire immediately |
1197 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1197 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1198 | 1198 | } else { |
1199 | 1199 | // delay until other systems are online |
1200 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1200 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1201 | 1201 | // convert classname to UPPERCASE and create WP shortcode. |
1202 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1202 | + $shortcode_tag = strtoupper($shortcode); |
|
1203 | 1203 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1204 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1204 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1205 | 1205 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1206 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1206 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | } |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | private function _initialize_modules() { |
1222 | 1222 | // cycle thru shortcode folders |
1223 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1223 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1224 | 1224 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1225 | 1225 | // which set hooks ? |
1226 | - if ( is_admin() ) { |
|
1226 | + if (is_admin()) { |
|
1227 | 1227 | // fire immediately |
1228 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1228 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1229 | 1229 | } else { |
1230 | 1230 | // delay until other systems are online |
1231 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1231 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1232 | 1232 | } |
1233 | 1233 | } |
1234 | 1234 | } |
@@ -1246,26 +1246,26 @@ discard block |
||
1246 | 1246 | * @param string $key - url param key indicating a route is being called |
1247 | 1247 | * @return bool |
1248 | 1248 | */ |
1249 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1250 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1251 | - $module = str_replace( 'EED_', '', $module ); |
|
1252 | - $module_class = 'EED_' . $module; |
|
1253 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
1254 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1250 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1251 | + $module = str_replace('EED_', '', $module); |
|
1252 | + $module_class = 'EED_'.$module; |
|
1253 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
1254 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | - if ( empty( $route )) { |
|
1259 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1258 | + if (empty($route)) { |
|
1259 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1261 | 1261 | return FALSE; |
1262 | 1262 | } |
1263 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1264 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1265 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1263 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1264 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1265 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1266 | 1266 | return FALSE; |
1267 | 1267 | } |
1268 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1268 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1269 | 1269 | return TRUE; |
1270 | 1270 | } |
1271 | 1271 | |
@@ -1279,11 +1279,11 @@ discard block |
||
1279 | 1279 | * @param string $key - url param key indicating a route is being called |
1280 | 1280 | * @return string |
1281 | 1281 | */ |
1282 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1283 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1284 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1285 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1286 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1282 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1283 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1284 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1285 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1286 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1287 | 1287 | } |
1288 | 1288 | return NULL; |
1289 | 1289 | } |
@@ -1312,35 +1312,35 @@ discard block |
||
1312 | 1312 | * @param string $key - url param key indicating a route is being called |
1313 | 1313 | * @return bool |
1314 | 1314 | */ |
1315 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1316 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1317 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1318 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1319 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1315 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1316 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1317 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1318 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1319 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1320 | 1320 | return FALSE; |
1321 | 1321 | } |
1322 | - if ( empty( $forward )) { |
|
1323 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1324 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1322 | + if (empty($forward)) { |
|
1323 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1324 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1325 | 1325 | return FALSE; |
1326 | 1326 | } |
1327 | - if ( is_array( $forward )) { |
|
1328 | - if ( ! isset( $forward[1] )) { |
|
1329 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + if (is_array($forward)) { |
|
1328 | + if ( ! isset($forward[1])) { |
|
1329 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } |
1333 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1334 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1335 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1333 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1334 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1335 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1336 | 1336 | return FALSE; |
1337 | 1337 | } |
1338 | - } else if ( ! function_exists( $forward )) { |
|
1339 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1340 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + } else if ( ! function_exists($forward)) { |
|
1339 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1340 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1341 | 1341 | return FALSE; |
1342 | 1342 | } |
1343 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1343 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1344 | 1344 | return TRUE; |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1355,10 +1355,10 @@ discard block |
||
1355 | 1355 | * @param string $key - url param key indicating a route is being called |
1356 | 1356 | * @return string |
1357 | 1357 | */ |
1358 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1359 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1360 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1361 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1358 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1359 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1360 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1361 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1362 | 1362 | } |
1363 | 1363 | return NULL; |
1364 | 1364 | } |
@@ -1375,19 +1375,19 @@ discard block |
||
1375 | 1375 | * @param string $key - url param key indicating a route is being called |
1376 | 1376 | * @return bool |
1377 | 1377 | */ |
1378 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1379 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1380 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1381 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1382 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1378 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1379 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1380 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1381 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1382 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1383 | 1383 | return FALSE; |
1384 | 1384 | } |
1385 | - if ( ! is_readable( $view )) { |
|
1386 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1387 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1385 | + if ( ! is_readable($view)) { |
|
1386 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1387 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1388 | 1388 | return FALSE; |
1389 | 1389 | } |
1390 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1390 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1391 | 1391 | return TRUE; |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1404,10 +1404,10 @@ discard block |
||
1404 | 1404 | * @param string $key - url param key indicating a route is being called |
1405 | 1405 | * @return string |
1406 | 1406 | */ |
1407 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1408 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1409 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1410 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1407 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1408 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1409 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1410 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1411 | 1411 | } |
1412 | 1412 | return NULL; |
1413 | 1413 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | |
1417 | 1417 | public function shutdown() { |
1418 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1418 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1432 | 1432 | * basically, they should just be well-defined stdClasses |
1433 | 1433 | */ |
1434 | -class EE_Config_Base{ |
|
1434 | +class EE_Config_Base { |
|
1435 | 1435 | |
1436 | 1436 | /** |
1437 | 1437 | * Utility function for escaping the value of a property and returning. |
@@ -1440,13 +1440,13 @@ discard block |
||
1440 | 1440 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1441 | 1441 | * @throws \EE_Error |
1442 | 1442 | */ |
1443 | - public function get_pretty( $property ) { |
|
1444 | - if ( ! property_exists( $this, $property ) ) { |
|
1445 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1443 | + public function get_pretty($property) { |
|
1444 | + if ( ! property_exists($this, $property)) { |
|
1445 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1446 | 1446 | } |
1447 | 1447 | //just handling escaping of strings for now. |
1448 | - if ( is_string( $this->$property ) ) { |
|
1449 | - return stripslashes( $this->$property ); |
|
1448 | + if (is_string($this->$property)) { |
|
1449 | + return stripslashes($this->$property); |
|
1450 | 1450 | } |
1451 | 1451 | return $this->$property; |
1452 | 1452 | } |
@@ -1455,19 +1455,19 @@ discard block |
||
1455 | 1455 | |
1456 | 1456 | public function populate() { |
1457 | 1457 | //grab defaults via a new instance of this class. |
1458 | - $class_name = get_class( $this ); |
|
1458 | + $class_name = get_class($this); |
|
1459 | 1459 | $defaults = new $class_name; |
1460 | 1460 | |
1461 | 1461 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1462 | 1462 | //default from our $defaults object. |
1463 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1464 | - if ( is_null( $this->$property ) ) { |
|
1463 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1464 | + if (is_null($this->$property)) { |
|
1465 | 1465 | $this->$property = $value; |
1466 | 1466 | } |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | //cleanup |
1470 | - unset( $defaults ); |
|
1470 | + unset($defaults); |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | |
@@ -1559,12 +1559,12 @@ discard block |
||
1559 | 1559 | */ |
1560 | 1560 | public function __construct() { |
1561 | 1561 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1562 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1562 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1563 | 1563 | // set default organization settings |
1564 | 1564 | $this->current_blog_id = get_current_blog_id(); |
1565 | 1565 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1566 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1567 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1566 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1567 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1568 | 1568 | $this->post_shortcodes = array(); |
1569 | 1569 | $this->module_route_map = array(); |
1570 | 1570 | $this->module_forward_map = array(); |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1584 | 1584 | |
1585 | 1585 | //ueip constant check |
1586 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1586 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1587 | 1587 | $this->ee_ueip_optin = FALSE; |
1588 | 1588 | $this->ee_ueip_has_notified = TRUE; |
1589 | 1589 | } |
@@ -1623,8 +1623,8 @@ discard block |
||
1623 | 1623 | * @return string |
1624 | 1624 | */ |
1625 | 1625 | public function reg_page_url() { |
1626 | - if ( ! $this->reg_page_url ) { |
|
1627 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1626 | + if ( ! $this->reg_page_url) { |
|
1627 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1628 | 1628 | } |
1629 | 1629 | return $this->reg_page_url; |
1630 | 1630 | } |
@@ -1637,12 +1637,12 @@ discard block |
||
1637 | 1637 | * @return string |
1638 | 1638 | */ |
1639 | 1639 | public function txn_page_url($query_args = array()) { |
1640 | - if ( ! $this->txn_page_url ) { |
|
1641 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1640 | + if ( ! $this->txn_page_url) { |
|
1641 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1642 | 1642 | } |
1643 | - if($query_args){ |
|
1644 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1645 | - }else{ |
|
1643 | + if ($query_args) { |
|
1644 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1645 | + } else { |
|
1646 | 1646 | return $this->txn_page_url; |
1647 | 1647 | } |
1648 | 1648 | } |
@@ -1654,12 +1654,12 @@ discard block |
||
1654 | 1654 | * @return string |
1655 | 1655 | */ |
1656 | 1656 | public function thank_you_page_url($query_args = array()) { |
1657 | - if ( ! $this->thank_you_page_url ) { |
|
1658 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1657 | + if ( ! $this->thank_you_page_url) { |
|
1658 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1659 | 1659 | } |
1660 | - if($query_args){ |
|
1661 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1662 | - }else{ |
|
1660 | + if ($query_args) { |
|
1661 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1662 | + } else { |
|
1663 | 1663 | return $this->thank_you_page_url; |
1664 | 1664 | } |
1665 | 1665 | } |
@@ -1670,8 +1670,8 @@ discard block |
||
1670 | 1670 | * @return string |
1671 | 1671 | */ |
1672 | 1672 | public function cancel_page_url() { |
1673 | - if ( ! $this->cancel_page_url ) { |
|
1674 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1673 | + if ( ! $this->cancel_page_url) { |
|
1674 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1675 | 1675 | } |
1676 | 1676 | return $this->cancel_page_url; |
1677 | 1677 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | //reset all url properties |
1700 | 1700 | $this->_reset_urls(); |
1701 | 1701 | //return what to save to db |
1702 | - return array_keys( get_object_vars( $this ) ); |
|
1702 | + return array_keys(get_object_vars($this)); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | } |
@@ -1931,39 +1931,39 @@ discard block |
||
1931 | 1931 | * @param null $CNT_ISO |
1932 | 1932 | * @return \EE_Currency_Config |
1933 | 1933 | */ |
1934 | - public function __construct( $CNT_ISO = NULL ) { |
|
1934 | + public function __construct($CNT_ISO = NULL) { |
|
1935 | 1935 | |
1936 | 1936 | // get country code from organization settings or use default |
1937 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1937 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1938 | 1938 | // but override if requested |
1939 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1940 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1939 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1940 | + EE_Registry::instance()->load_helper('Activation'); |
|
1941 | 1941 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
1942 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1942 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1943 | 1943 | // retrieve the country settings from the db, just in case they have been customized |
1944 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1945 | - if ( $country instanceof EE_Country ) { |
|
1946 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | - $this->name = $country->currency_name_single(); // Dollar |
|
1948 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1944 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1945 | + if ($country instanceof EE_Country) { |
|
1946 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | + $this->name = $country->currency_name_single(); // Dollar |
|
1948 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | // fallback to hardcoded defaults, in case the above failed |
1957 | - if ( empty( $this->code )) { |
|
1957 | + if (empty($this->code)) { |
|
1958 | 1958 | // set default currency settings |
1959 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1961 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1962 | - $this->sign = '$'; // currency sign: $ |
|
1963 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1959 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1961 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1962 | + $this->sign = '$'; // currency sign: $ |
|
1963 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1967 | 1967 | } |
1968 | 1968 | } |
1969 | 1969 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | * @since 4.8.8.rc.019 |
2104 | 2104 | */ |
2105 | 2105 | public function do_hooks() { |
2106 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2106 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | |
@@ -2111,7 +2111,7 @@ discard block |
||
2111 | 2111 | * @return void |
2112 | 2112 | */ |
2113 | 2113 | public function set_default_reg_status_on_EEM_Event() { |
2114 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2114 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
@@ -2216,10 +2216,10 @@ discard block |
||
2216 | 2216 | * @param bool $reset |
2217 | 2217 | * @return string |
2218 | 2218 | */ |
2219 | - public function log_file_name( $reset = FALSE ) { |
|
2220 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2221 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2222 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2219 | + public function log_file_name($reset = FALSE) { |
|
2220 | + if (empty($this->log_file_name) || $reset) { |
|
2221 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2222 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2223 | 2223 | } |
2224 | 2224 | return $this->log_file_name; |
2225 | 2225 | } |
@@ -2231,10 +2231,10 @@ discard block |
||
2231 | 2231 | * @param bool $reset |
2232 | 2232 | * @return string |
2233 | 2233 | */ |
2234 | - public function debug_file_name( $reset = FALSE ) { |
|
2235 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2236 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2237 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2234 | + public function debug_file_name($reset = FALSE) { |
|
2235 | + if (empty($this->debug_file_name) || $reset) { |
|
2236 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2237 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2238 | 2238 | } |
2239 | 2239 | return $this->debug_file_name; |
2240 | 2240 | } |
@@ -2407,21 +2407,21 @@ discard block |
||
2407 | 2407 | // set default map settings |
2408 | 2408 | $this->use_google_maps = TRUE; |
2409 | 2409 | // for event details pages (reg page) |
2410 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2410 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2417 | 2417 | // for event list pages |
2418 | - $this->event_list_map_width = 300; // ee_map_width |
|
2419 | - $this->event_list_map_height = 185; // ee_map_height |
|
2420 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2418 | + $this->event_list_map_width = 300; // ee_map_width |
|
2419 | + $this->event_list_map_height = 185; // ee_map_height |
|
2420 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | } |
@@ -2432,7 +2432,7 @@ discard block |
||
2432 | 2432 | /** |
2433 | 2433 | * stores Events_Archive settings |
2434 | 2434 | */ |
2435 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2435 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2436 | 2436 | |
2437 | 2437 | public $display_status_banner; |
2438 | 2438 | public $display_description; |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | /** |
2452 | 2452 | * class constructor |
2453 | 2453 | */ |
2454 | - public function __construct(){ |
|
2454 | + public function __construct() { |
|
2455 | 2455 | $this->display_status_banner = 0; |
2456 | 2456 | $this->display_description = 1; |
2457 | 2457 | $this->display_ticket_selector = 0; |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | /** |
2472 | 2472 | * Stores Event_Single_Config settings |
2473 | 2473 | */ |
2474 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2474 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2475 | 2475 | |
2476 | 2476 | public $display_status_banner_single; |
2477 | 2477 | public $display_venue; |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | /** |
2501 | 2501 | * Stores Ticket_Selector_Config settings |
2502 | 2502 | */ |
2503 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2503 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2504 | 2504 | public $show_ticket_sale_columns; |
2505 | 2505 | public $show_ticket_details; |
2506 | 2506 | public $show_expired_tickets; |
@@ -2554,7 +2554,7 @@ discard block |
||
2554 | 2554 | * @return void |
2555 | 2555 | */ |
2556 | 2556 | protected function _set_php_values() { |
2557 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2557 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2558 | 2558 | $this->php->version = phpversion(); |
2559 | 2559 | } |
2560 | 2560 | |
@@ -2573,8 +2573,8 @@ discard block |
||
2573 | 2573 | * @type string $msg Any message to be displayed. |
2574 | 2574 | * } |
2575 | 2575 | */ |
2576 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2577 | - if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2576 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2577 | + if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2578 | 2578 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
2579 | 2579 | } else { |
2580 | 2580 | return ''; |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | * stores payment gateway info |
2611 | 2611 | * @deprecated |
2612 | 2612 | */ |
2613 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2613 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2614 | 2614 | |
2615 | 2615 | /** |
2616 | 2616 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2632,9 +2632,9 @@ discard block |
||
2632 | 2632 | * class constructor |
2633 | 2633 | * @deprecated |
2634 | 2634 | */ |
2635 | - public function __construct(){ |
|
2635 | + public function __construct() { |
|
2636 | 2636 | $this->payment_settings = array(); |
2637 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2637 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 |
@@ -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'), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EE_Payment_Processor |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function instance() { |
29 | 29 | // check if class object is instantiated |
30 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
30 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
31 | 31 | self::$_instance = new self(); |
32 | 32 | } |
33 | 33 | return self::$_instance; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | *@return EE_Payment_Processor |
43 | 43 | */ |
44 | 44 | private function __construct() { |
45 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
45 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -64,42 +64,42 @@ discard block |
||
64 | 64 | * @param string $cancel_url URL to return to if off-site payments are cancelled |
65 | 65 | * @return EE_Payment |
66 | 66 | */ |
67 | - public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) { |
|
68 | - if( $amount < 0 ) { |
|
67 | + public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') { |
|
68 | + if ($amount < 0) { |
|
69 | 69 | throw new EE_Error( |
70 | 70 | sprintf( |
71 | - __( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ), |
|
71 | + __('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'), |
|
72 | 72 | $amount, |
73 | 73 | $transaction->ID() ) ); |
74 | 74 | } |
75 | 75 | // verify payment method |
76 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
76 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
77 | 77 | // verify transaction |
78 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
79 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
78 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
79 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
80 | 80 | // verify payment method type |
81 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
81 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
82 | 82 | $payment = $payment_method->type_obj()->process_payment( |
83 | 83 | $transaction, |
84 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
84 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
85 | 85 | $billing_form, |
86 | 86 | $return_url, |
87 | - add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
87 | + add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
88 | 88 | $method, |
89 | 89 | $by_admin |
90 | 90 | ); |
91 | 91 | // check if payment method uses an off-site gateway |
92 | - if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) { |
|
92 | + if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) { |
|
93 | 93 | // don't process payments for off-site gateways yet because no payment has occurred yet |
94 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
94 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
95 | 95 | } |
96 | 96 | return $payment; |
97 | 97 | } else { |
98 | 98 | EE_Error::add_error( |
99 | 99 | sprintf( |
100 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
100 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
101 | 101 | '<br/>', |
102 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
102 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
103 | 103 | ), __FILE__, __FUNCTION__, __LINE__ |
104 | 104 | ); |
105 | 105 | return NULL; |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | * @throws EE_Error |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
118 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
119 | 119 | /** @type EE_Transaction $transaction */ |
120 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
120 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
121 | 121 | $primary_reg = $transaction->primary_registration(); |
122 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
123 | - throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID())); |
|
122 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
123 | + throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID())); |
|
124 | 124 | } |
125 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
125 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
126 | 126 | $url = add_query_arg( |
127 | 127 | array( |
128 | 128 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -149,81 +149,81 @@ discard block |
||
149 | 149 | * @throws Exception |
150 | 150 | * @return EE_Payment |
151 | 151 | */ |
152 | - public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){ |
|
153 | - $_req_data = $this->_remove_unusable_characters( $_req_data ); |
|
154 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
155 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
156 | - if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
|
157 | - $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
|
158 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
152 | + public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) { |
|
153 | + $_req_data = $this->_remove_unusable_characters($_req_data); |
|
154 | + EE_Registry::instance()->load_model('Change_Log'); |
|
155 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
156 | + if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) { |
|
157 | + $obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc'))); |
|
158 | + }elseif ($payment_method instanceof EE_Payment) { |
|
159 | 159 | $obj_for_log = $payment_method; |
160 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
160 | + }elseif ($transaction instanceof EE_Transaction) { |
|
161 | 161 | $obj_for_log = $transaction; |
162 | - }else{ |
|
162 | + } else { |
|
163 | 163 | $obj_for_log = null; |
164 | 164 | } |
165 | 165 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
166 | - try{ |
|
166 | + try { |
|
167 | 167 | /** |
168 | 168 | * @var EE_Payment $payment |
169 | 169 | */ |
170 | 170 | $payment = NULL; |
171 | - if($transaction && $payment_method){ |
|
171 | + if ($transaction && $payment_method) { |
|
172 | 172 | /** @type EE_Transaction $transaction */ |
173 | 173 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
174 | 174 | /** @type EE_Payment_Method $payment_method */ |
175 | 175 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
176 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
177 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
176 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
177 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
178 | 178 | $log->set_object($payment); |
179 | 179 | } else { |
180 | 180 | // not a payment |
181 | 181 | EE_Error::add_error( |
182 | 182 | sprintf( |
183 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
183 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
184 | 184 | '<br/>', |
185 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
185 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
186 | 186 | ), |
187 | 187 | __FILE__, __FUNCTION__, __LINE__ |
188 | 188 | ); |
189 | 189 | } |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | //that's actually pretty ok. The IPN just wasn't able |
192 | 192 | //to identify which transaction or payment method this was for |
193 | 193 | // give all active payment methods a chance to claim it |
194 | 194 | $active_pms = EEM_Payment_Method::instance()->get_all_active(); |
195 | - foreach( $active_pms as $payment_method ){ |
|
196 | - try{ |
|
197 | - $payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
195 | + foreach ($active_pms as $payment_method) { |
|
196 | + try { |
|
197 | + $payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
198 | 198 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment); |
199 | 199 | break; |
200 | - } catch( EE_Error $e ) { |
|
200 | + } catch (EE_Error $e) { |
|
201 | 201 | //that's fine- it apparently couldn't handle the IPN |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | } |
206 | 206 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
207 | - if( $payment instanceof EE_Payment){ |
|
207 | + if ($payment instanceof EE_Payment) { |
|
208 | 208 | $payment->save(); |
209 | 209 | // update the TXN |
210 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
211 | - }else{ |
|
210 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
211 | + } else { |
|
212 | 212 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
213 | - if($payment_method){ |
|
213 | + if ($payment_method) { |
|
214 | 214 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
215 | - }elseif($transaction){ |
|
215 | + }elseif ($transaction) { |
|
216 | 216 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | return $payment; |
220 | 220 | |
221 | - } catch( EE_Error $e ) { |
|
221 | + } catch (EE_Error $e) { |
|
222 | 222 | do_action( |
223 | 223 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
224 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
225 | - print_r( $transaction, TRUE ), |
|
226 | - print_r( $_req_data, TRUE ), |
|
224 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
225 | + print_r($transaction, TRUE), |
|
226 | + print_r($_req_data, TRUE), |
|
227 | 227 | $e->getMessage() |
228 | 228 | ) |
229 | 229 | ); |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | * @param array $request_data |
238 | 238 | * @return array|string |
239 | 239 | */ |
240 | - protected function _remove_unusable_characters( $request_data ) { |
|
241 | - if( is_array( $request_data ) ) { |
|
240 | + protected function _remove_unusable_characters($request_data) { |
|
241 | + if (is_array($request_data)) { |
|
242 | 242 | $return_data = array(); |
243 | - foreach( $request_data as $key => $value ) { |
|
244 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
243 | + foreach ($request_data as $key => $value) { |
|
244 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
245 | 245 | } |
246 | - }else{ |
|
247 | - $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
246 | + } else { |
|
247 | + $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
248 | 248 | } |
249 | 249 | return $return_data; |
250 | 250 | } |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | * @return EE_Payment |
267 | 267 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs |
268 | 268 | */ |
269 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
269 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
270 | 270 | /** @var $transaction EE_Transaction */ |
271 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
271 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
272 | 272 | $last_payment_method = $transaction->payment_method(); |
273 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
274 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
275 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
273 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
274 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
275 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
276 | 276 | return $payment; |
277 | 277 | } else { |
278 | 278 | return NULL; |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * @internal param float $amount |
290 | 290 | * @return EE_Payment |
291 | 291 | */ |
292 | - public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){ |
|
293 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
294 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
295 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
292 | + public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) { |
|
293 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
294 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
295 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
296 | 296 | } |
297 | 297 | return $payment_to_refund; |
298 | 298 | } |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * TXN is locked before updating |
335 | 335 | * @throws \EE_Error |
336 | 336 | */ |
337 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
337 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
338 | 338 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
339 | 339 | /** @type EE_Transaction $transaction */ |
340 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
340 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
341 | 341 | // can we freely update the TXN at this moment? |
342 | - if ( $IPN && $transaction->is_locked() ) { |
|
342 | + if ($IPN && $transaction->is_locked()) { |
|
343 | 343 | // don't update the transaction at this exact moment |
344 | 344 | // because the TXN is active in another request |
345 | 345 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -349,40 +349,40 @@ discard block |
||
349 | 349 | ); |
350 | 350 | } else { |
351 | 351 | // verify payment and that it has been saved |
352 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
353 | - if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){ |
|
354 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
352 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
353 | + if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) { |
|
354 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
355 | 355 | // update TXN registrations with payment info |
356 | - $this->process_registration_payments( $transaction, $payment ); |
|
356 | + $this->process_registration_payments($transaction, $payment); |
|
357 | 357 | } |
358 | 358 | $do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action; |
359 | 359 | } else { |
360 | 360 | // send out notifications |
361 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
361 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
362 | 362 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
363 | 363 | } |
364 | 364 | // if this is an IPN, then we want to know the initial TXN status prior to updating the TXN |
365 | 365 | // so that we know whether the status has changed and notifications should be triggered |
366 | - if ( $IPN ) { |
|
366 | + if ($IPN) { |
|
367 | 367 | /** @type EE_Transaction_Processor $transaction_processor */ |
368 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
369 | - $transaction_processor->set_old_txn_status( $transaction->status_ID() ); |
|
368 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
369 | + $transaction_processor->set_old_txn_status($transaction->status_ID()); |
|
370 | 370 | } |
371 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
371 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
372 | 372 | /** @type EE_Transaction_Payments $transaction_payments */ |
373 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
373 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
374 | 374 | // set new value for total paid |
375 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
375 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
376 | 376 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
377 | - if ( $update_txn ) { |
|
378 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
377 | + if ($update_txn) { |
|
378 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | // granular hook for others to use. |
382 | - do_action( $do_action, $transaction, $payment ); |
|
383 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
382 | + do_action($do_action, $transaction, $payment); |
|
383 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
384 | 384 | //global hook for others to use. |
385 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
385 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
@@ -396,25 +396,25 @@ discard block |
||
396 | 396 | * @param EE_Registration[] $registrations |
397 | 397 | * @throws \EE_Error |
398 | 398 | */ |
399 | - public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) { |
|
399 | + public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) { |
|
400 | 400 | // only process if payment was successful |
401 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
401 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
402 | 402 | return; |
403 | 403 | } |
404 | 404 | //EEM_Registration::instance()->show_next_x_db_queries(); |
405 | - if ( empty( $registrations )) { |
|
405 | + if (empty($registrations)) { |
|
406 | 406 | // find registrations with monies owing that can receive a payment |
407 | - $registrations = $transaction->registrations( array( |
|
407 | + $registrations = $transaction->registrations(array( |
|
408 | 408 | array( |
409 | 409 | // only these reg statuses can receive payments |
410 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
411 | - 'REG_final_price' => array( '!=', 0 ), |
|
412 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
410 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
411 | + 'REG_final_price' => array('!=', 0), |
|
412 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
413 | 413 | ) |
414 | - ) ); |
|
414 | + )); |
|
415 | 415 | } |
416 | 416 | // still nothing ??!?? |
417 | - if ( empty( $registrations )) { |
|
417 | + if (empty($registrations)) { |
|
418 | 418 | return; |
419 | 419 | } |
420 | 420 | // todo: break out the following logic into a separate strategy class |
@@ -426,28 +426,28 @@ discard block |
||
426 | 426 | |
427 | 427 | $refund = $payment->is_a_refund(); |
428 | 428 | // how much is available to apply to registrations? |
429 | - $available_payment_amount = abs( $payment->amount() ); |
|
430 | - foreach ( $registrations as $registration ) { |
|
431 | - if ( $registration instanceof EE_Registration ) { |
|
429 | + $available_payment_amount = abs($payment->amount()); |
|
430 | + foreach ($registrations as $registration) { |
|
431 | + if ($registration instanceof EE_Registration) { |
|
432 | 432 | // nothing left? |
433 | - if ( $available_payment_amount <= 0 ) { |
|
433 | + if ($available_payment_amount <= 0) { |
|
434 | 434 | break; |
435 | 435 | } |
436 | - if ( $refund ) { |
|
437 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
436 | + if ($refund) { |
|
437 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
438 | 438 | } else { |
439 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
439 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | } |
443 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
443 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
444 | 444 | EE_Error::add_attention( |
445 | 445 | sprintf( |
446 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
447 | - EEH_Template::format_currency( $available_payment_amount ), |
|
448 | - implode( ', ', array_keys( $registrations ) ), |
|
446 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
447 | + EEH_Template::format_currency($available_payment_amount), |
|
448 | + implode(', ', array_keys($registrations)), |
|
449 | 449 | '<br/>', |
450 | - EEH_Template::format_currency( $payment->amount() ) |
|
450 | + EEH_Template::format_currency($payment->amount()) |
|
451 | 451 | ), |
452 | 452 | __FILE__, __FUNCTION__, __LINE__ |
453 | 453 | ); |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | * @param float $available_payment_amount |
465 | 465 | * @return float |
466 | 466 | */ |
467 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
467 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
468 | 468 | $owing = $registration->final_price() - $registration->paid(); |
469 | - if ( $owing > 0 ) { |
|
469 | + if ($owing > 0) { |
|
470 | 470 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
471 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
471 | + $payment_amount = min($available_payment_amount, $owing); |
|
472 | 472 | // update $available_payment_amount |
473 | 473 | $available_payment_amount = $available_payment_amount - $payment_amount; |
474 | 474 | //calculate and set new REG_paid |
475 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
475 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
476 | 476 | // now save it |
477 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
477 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
478 | 478 | } |
479 | 479 | return $available_payment_amount; |
480 | 480 | } |
@@ -489,19 +489,19 @@ discard block |
||
489 | 489 | * @param float $payment_amount |
490 | 490 | * @return float |
491 | 491 | */ |
492 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
492 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
493 | 493 | // find any existing reg payment records for this registration and payment |
494 | 494 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
495 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
495 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
496 | 496 | ); |
497 | 497 | // if existing registration payment exists |
498 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
498 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
499 | 499 | // then update that record |
500 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
500 | + $existing_reg_payment->set_amount($payment_amount); |
|
501 | 501 | $existing_reg_payment->save(); |
502 | 502 | } else { |
503 | 503 | // or add new relation between registration and payment and set amount |
504 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
504 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
505 | 505 | // make it stick |
506 | 506 | $registration->save(); |
507 | 507 | } |
@@ -517,21 +517,21 @@ discard block |
||
517 | 517 | * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER |
518 | 518 | * @return float |
519 | 519 | */ |
520 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
520 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
521 | 521 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
522 | - if ( $registration->paid() > 0 ) { |
|
522 | + if ($registration->paid() > 0) { |
|
523 | 523 | // ensure $available_refund_amount is NOT negative |
524 | - $available_refund_amount = abs( $available_refund_amount ); |
|
524 | + $available_refund_amount = abs($available_refund_amount); |
|
525 | 525 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
526 | - $refund_amount = min( $available_refund_amount, $registration->paid() ); |
|
526 | + $refund_amount = min($available_refund_amount, $registration->paid()); |
|
527 | 527 | // update $available_payment_amount |
528 | 528 | $available_refund_amount = $available_refund_amount - $refund_amount; |
529 | 529 | //calculate and set new REG_paid |
530 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
530 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
531 | 531 | // convert payment amount back to a negative value for storage in the db |
532 | - $refund_amount = abs( $refund_amount ) * -1; |
|
532 | + $refund_amount = abs($refund_amount) * -1; |
|
533 | 533 | // now save it |
534 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
534 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
535 | 535 | } |
536 | 536 | return $available_refund_amount; |
537 | 537 | } |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | * @param EE_Payment $payment |
550 | 550 | * @param bool $IPN |
551 | 551 | */ |
552 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
552 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
553 | 553 | |
554 | 554 | /** @type EE_Transaction_Processor $transaction_processor */ |
555 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
555 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
556 | 556 | // is the Payment Options Reg Step completed ? |
557 | - $payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' ); |
|
557 | + $payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options'); |
|
558 | 558 | // DEBUG LOG |
559 | 559 | //$this->log( |
560 | 560 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | // if the Payment Options Reg Step is completed... |
568 | 568 | $revisit = $payment_options_step_completed === true ? true : false; |
569 | 569 | // then this is kinda sorta a revisit with regards to payments at least |
570 | - $transaction_processor->set_revisit( $revisit ); |
|
570 | + $transaction_processor->set_revisit($revisit); |
|
571 | 571 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
572 | 572 | if ( |
573 | 573 | $IPN && |
574 | 574 | $payment_options_step_completed !== true && |
575 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
575 | + ($payment->is_approved() || $payment->is_pending()) |
|
576 | 576 | ) { |
577 | - $payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' ); |
|
577 | + $payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options'); |
|
578 | 578 | } |
579 | 579 | // DEBUG LOG |
580 | 580 | //$this->log( |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | // ) |
587 | 587 | //); |
588 | 588 | /** @type EE_Transaction_Payments $transaction_payments */ |
589 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
589 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
590 | 590 | // maybe update status, but don't save transaction just yet |
591 | - $transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
591 | + $transaction_payments->update_transaction_status_based_on_total_paid($transaction, false); |
|
592 | 592 | // check if 'finalize_registration' step has been completed... |
593 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
593 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
594 | 594 | // DEBUG LOG |
595 | 595 | //$this->log( |
596 | 596 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | // ) |
602 | 602 | //); |
603 | 603 | // if this is an IPN and the final step has not been initiated |
604 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
604 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
605 | 605 | // and if it hasn't already been set as being started... |
606 | - $finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
606 | + $finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
607 | 607 | // DEBUG LOG |
608 | 608 | //$this->log( |
609 | 609 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | } |
617 | 617 | $transaction->save(); |
618 | 618 | // because the above will return false if the final step was not fully completed, we need to check again... |
619 | - if ( $IPN && $finalized !== false ) { |
|
619 | + if ($IPN && $finalized !== false) { |
|
620 | 620 | // and if we are all good to go, then send out notifications |
621 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
621 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
622 | 622 | // DEBUG LOG |
623 | 623 | //$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction ); |
624 | 624 | //ok, now process the transaction according to the payment |
625 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
625 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
626 | 626 | } |
627 | 627 | // DEBUG LOG |
628 | 628 | //$this->log( |
@@ -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 | ?> |