@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,102 +67,102 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.17.rc.007' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.17.rc.007'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ); |
64 | 64 | add_action( |
65 | 65 | 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', |
66 | - array( $this, 'verify_event_edit' ) |
|
66 | + array($this, 'verify_event_edit') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -79,22 +79,22 @@ discard block |
||
79 | 79 | $this->_admin_page_title = EVENTS_LABEL; |
80 | 80 | $this->_labels = array( |
81 | 81 | 'buttons' => array( |
82 | - 'add' => esc_html__( 'Add New Event', 'event_espresso' ), |
|
83 | - 'edit' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
84 | - 'delete' => esc_html__( 'Delete Event', 'event_espresso' ), |
|
85 | - 'add_category' => esc_html__( 'Add New Category', 'event_espresso' ), |
|
86 | - 'edit_category' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
87 | - 'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ), |
|
82 | + 'add' => esc_html__('Add New Event', 'event_espresso'), |
|
83 | + 'edit' => esc_html__('Edit Event', 'event_espresso'), |
|
84 | + 'delete' => esc_html__('Delete Event', 'event_espresso'), |
|
85 | + 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
86 | + 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
87 | + 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
88 | 88 | ), |
89 | 89 | 'editor_title' => array( |
90 | - 'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ), |
|
90 | + 'espresso_events' => esc_html__('Enter event title here', 'event_espresso'), |
|
91 | 91 | ), |
92 | 92 | 'publishbox' => array( |
93 | - 'create_new' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
94 | - 'edit' => esc_html__( 'Update Event', 'event_espresso' ), |
|
95 | - 'add_category' => esc_html__( 'Save New Category', 'event_espresso' ), |
|
96 | - 'edit_category' => esc_html__( 'Update Category', 'event_espresso' ), |
|
97 | - 'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
93 | + 'create_new' => esc_html__('Save New Event', 'event_espresso'), |
|
94 | + 'edit' => esc_html__('Update Event', 'event_espresso'), |
|
95 | + 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
96 | + 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
97 | + 'template_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
98 | 98 | ), |
99 | 99 | ); |
100 | 100 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | //load formatter helper |
106 | 106 | //load field generator helper |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
109 | 109 | ? $this->_req_data['EVT_ID'] : 0; |
110 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
110 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
111 | 111 | $this->_page_routes = array( |
112 | 112 | 'default' => array( |
113 | 113 | 'func' => '_events_overview_list_table', |
@@ -130,27 +130,27 @@ discard block |
||
130 | 130 | ), |
131 | 131 | 'trash_event' => array( |
132 | 132 | 'func' => '_trash_or_restore_event', |
133 | - 'args' => array( 'event_status' => 'trash' ), |
|
133 | + 'args' => array('event_status' => 'trash'), |
|
134 | 134 | 'capability' => 'ee_delete_event', |
135 | 135 | 'obj_id' => $evt_id, |
136 | 136 | 'noheader' => true, |
137 | 137 | ), |
138 | 138 | 'trash_events' => array( |
139 | 139 | 'func' => '_trash_or_restore_events', |
140 | - 'args' => array( 'event_status' => 'trash' ), |
|
140 | + 'args' => array('event_status' => 'trash'), |
|
141 | 141 | 'capability' => 'ee_delete_events', |
142 | 142 | 'noheader' => true, |
143 | 143 | ), |
144 | 144 | 'restore_event' => array( |
145 | 145 | 'func' => '_trash_or_restore_event', |
146 | - 'args' => array( 'event_status' => 'draft' ), |
|
146 | + 'args' => array('event_status' => 'draft'), |
|
147 | 147 | 'capability' => 'ee_delete_event', |
148 | 148 | 'obj_id' => $evt_id, |
149 | 149 | 'noheader' => true, |
150 | 150 | ), |
151 | 151 | 'restore_events' => array( |
152 | 152 | 'func' => '_trash_or_restore_events', |
153 | - 'args' => array( 'event_status' => 'draft' ), |
|
153 | + 'args' => array('event_status' => 'draft'), |
|
154 | 154 | 'capability' => 'ee_delete_events', |
155 | 155 | 'noheader' => true, |
156 | 156 | ), |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | 'add_category' => array( |
187 | 187 | 'func' => '_category_details', |
188 | 188 | 'capability' => 'ee_edit_event_category', |
189 | - 'args' => array( 'add' ), |
|
189 | + 'args' => array('add'), |
|
190 | 190 | ), |
191 | 191 | 'edit_category' => array( |
192 | 192 | 'func' => '_category_details', |
193 | 193 | 'capability' => 'ee_edit_event_category', |
194 | - 'args' => array( 'edit' ), |
|
194 | + 'args' => array('edit'), |
|
195 | 195 | ), |
196 | 196 | 'delete_categories' => array( |
197 | 197 | 'func' => '_delete_categories', |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | ), |
206 | 206 | 'insert_category' => array( |
207 | 207 | 'func' => '_insert_or_update_category', |
208 | - 'args' => array( 'new_category' => true ), |
|
208 | + 'args' => array('new_category' => true), |
|
209 | 209 | 'capability' => 'ee_edit_event_category', |
210 | 210 | 'noheader' => true, |
211 | 211 | ), |
212 | 212 | 'update_category' => array( |
213 | 213 | 'func' => '_insert_or_update_category', |
214 | - 'args' => array( 'new_category' => false ), |
|
214 | + 'args' => array('new_category' => false), |
|
215 | 215 | 'capability' => 'ee_edit_event_category', |
216 | 216 | 'noheader' => true, |
217 | 217 | ), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | $this->_page_config = array( |
229 | 229 | 'default' => array( |
230 | 230 | 'nav' => array( |
231 | - 'label' => esc_html__( 'Overview', 'event_espresso' ), |
|
231 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
232 | 232 | 'order' => 10, |
233 | 233 | ), |
234 | 234 | 'list_table' => 'Events_Admin_List_Table', |
235 | 235 | 'help_tabs' => array( |
236 | 236 | 'events_overview_help_tab' => array( |
237 | - 'title' => esc_html__( 'Events Overview', 'event_espresso' ), |
|
237 | + 'title' => esc_html__('Events Overview', 'event_espresso'), |
|
238 | 238 | 'filename' => 'events_overview', |
239 | 239 | ), |
240 | 240 | 'events_overview_table_column_headings_help_tab' => array( |
241 | - 'title' => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ), |
|
241 | + 'title' => esc_html__('Events Overview Table Column Headings', 'event_espresso'), |
|
242 | 242 | 'filename' => 'events_overview_table_column_headings', |
243 | 243 | ), |
244 | 244 | 'events_overview_filters_help_tab' => array( |
245 | - 'title' => esc_html__( 'Events Overview Filters', 'event_espresso' ), |
|
245 | + 'title' => esc_html__('Events Overview Filters', 'event_espresso'), |
|
246 | 246 | 'filename' => 'events_overview_filters', |
247 | 247 | ), |
248 | 248 | 'events_overview_view_help_tab' => array( |
249 | - 'title' => esc_html__( 'Events Overview Views', 'event_espresso' ), |
|
249 | + 'title' => esc_html__('Events Overview Views', 'event_espresso'), |
|
250 | 250 | 'filename' => 'events_overview_views', |
251 | 251 | ), |
252 | 252 | 'events_overview_other_help_tab' => array( |
253 | - 'title' => esc_html__( 'Events Overview Other', 'event_espresso' ), |
|
253 | + 'title' => esc_html__('Events Overview Other', 'event_espresso'), |
|
254 | 254 | 'filename' => 'events_overview_other', |
255 | 255 | ), |
256 | 256 | ), |
@@ -265,218 +265,218 @@ discard block |
||
265 | 265 | ), |
266 | 266 | 'create_new' => array( |
267 | 267 | 'nav' => array( |
268 | - 'label' => esc_html__( 'Add Event', 'event_espresso' ), |
|
268 | + 'label' => esc_html__('Add Event', 'event_espresso'), |
|
269 | 269 | 'order' => 5, |
270 | 270 | 'persistent' => false, |
271 | 271 | ), |
272 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
272 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
273 | 273 | 'help_tabs' => array( |
274 | 274 | 'event_editor_help_tab' => array( |
275 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
275 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
276 | 276 | 'filename' => 'event_editor', |
277 | 277 | ), |
278 | 278 | 'event_editor_title_richtexteditor_help_tab' => array( |
279 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
279 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
280 | 280 | 'filename' => 'event_editor_title_richtexteditor', |
281 | 281 | ), |
282 | 282 | 'event_editor_venue_details_help_tab' => array( |
283 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
283 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
284 | 284 | 'filename' => 'event_editor_venue_details', |
285 | 285 | ), |
286 | 286 | 'event_editor_event_datetimes_help_tab' => array( |
287 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
287 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
288 | 288 | 'filename' => 'event_editor_event_datetimes', |
289 | 289 | ), |
290 | 290 | 'event_editor_event_tickets_help_tab' => array( |
291 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
291 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
292 | 292 | 'filename' => 'event_editor_event_tickets', |
293 | 293 | ), |
294 | 294 | 'event_editor_event_registration_options_help_tab' => array( |
295 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
295 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
296 | 296 | 'filename' => 'event_editor_event_registration_options', |
297 | 297 | ), |
298 | 298 | 'event_editor_tags_categories_help_tab' => array( |
299 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
299 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
300 | 300 | 'filename' => 'event_editor_tags_categories', |
301 | 301 | ), |
302 | 302 | 'event_editor_questions_registrants_help_tab' => array( |
303 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
303 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
304 | 304 | 'filename' => 'event_editor_questions_registrants', |
305 | 305 | ), |
306 | 306 | 'event_editor_save_new_event_help_tab' => array( |
307 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
307 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
308 | 308 | 'filename' => 'event_editor_save_new_event', |
309 | 309 | ), |
310 | 310 | 'event_editor_other_help_tab' => array( |
311 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
311 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
312 | 312 | 'filename' => 'event_editor_other', |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | 'help_tour' => array( |
316 | 316 | 'Event_Editor_Help_Tour', |
317 | 317 | ), |
318 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
318 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
319 | 319 | 'require_nonce' => false, |
320 | 320 | ), |
321 | 321 | 'edit' => array( |
322 | 322 | 'nav' => array( |
323 | - 'label' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
323 | + 'label' => esc_html__('Edit Event', 'event_espresso'), |
|
324 | 324 | 'order' => 5, |
325 | 325 | 'persistent' => false, |
326 | - 'url' => isset( $this->_req_data['post'] ) |
|
326 | + 'url' => isset($this->_req_data['post']) |
|
327 | 327 | ? EE_Admin_Page::add_query_args_and_nonce( |
328 | - array( 'post' => $this->_req_data['post'], 'action' => 'edit' ), |
|
328 | + array('post' => $this->_req_data['post'], 'action' => 'edit'), |
|
329 | 329 | $this->_current_page_view_url |
330 | 330 | ) |
331 | 331 | : $this->_admin_base_url, |
332 | 332 | ), |
333 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
333 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
334 | 334 | 'help_tabs' => array( |
335 | 335 | 'event_editor_help_tab' => array( |
336 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
336 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
337 | 337 | 'filename' => 'event_editor', |
338 | 338 | ), |
339 | 339 | 'event_editor_title_richtexteditor_help_tab' => array( |
340 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
340 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
341 | 341 | 'filename' => 'event_editor_title_richtexteditor', |
342 | 342 | ), |
343 | 343 | 'event_editor_venue_details_help_tab' => array( |
344 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
344 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
345 | 345 | 'filename' => 'event_editor_venue_details', |
346 | 346 | ), |
347 | 347 | 'event_editor_event_datetimes_help_tab' => array( |
348 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
348 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
349 | 349 | 'filename' => 'event_editor_event_datetimes', |
350 | 350 | ), |
351 | 351 | 'event_editor_event_tickets_help_tab' => array( |
352 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
352 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
353 | 353 | 'filename' => 'event_editor_event_tickets', |
354 | 354 | ), |
355 | 355 | 'event_editor_event_registration_options_help_tab' => array( |
356 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
356 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
357 | 357 | 'filename' => 'event_editor_event_registration_options', |
358 | 358 | ), |
359 | 359 | 'event_editor_tags_categories_help_tab' => array( |
360 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
360 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
361 | 361 | 'filename' => 'event_editor_tags_categories', |
362 | 362 | ), |
363 | 363 | 'event_editor_questions_registrants_help_tab' => array( |
364 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
364 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
365 | 365 | 'filename' => 'event_editor_questions_registrants', |
366 | 366 | ), |
367 | 367 | 'event_editor_save_new_event_help_tab' => array( |
368 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
368 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
369 | 369 | 'filename' => 'event_editor_save_new_event', |
370 | 370 | ), |
371 | 371 | 'event_editor_other_help_tab' => array( |
372 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
372 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
373 | 373 | 'filename' => 'event_editor_other', |
374 | 374 | ), |
375 | 375 | ), |
376 | 376 | /*'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ),*/ |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => false, |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
383 | 383 | 'nav' => array( |
384 | - 'label' => esc_html__( 'Default Settings', 'event_espresso' ), |
|
384 | + 'label' => esc_html__('Default Settings', 'event_espresso'), |
|
385 | 385 | 'order' => 40, |
386 | 386 | ), |
387 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
387 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
388 | 388 | 'labels' => array( |
389 | - 'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
389 | + 'publishbox' => esc_html__('Update Settings', 'event_espresso'), |
|
390 | 390 | ), |
391 | 391 | 'help_tabs' => array( |
392 | 392 | 'default_settings_help_tab' => array( |
393 | - 'title' => esc_html__( 'Default Event Settings', 'event_espresso' ), |
|
393 | + 'title' => esc_html__('Default Event Settings', 'event_espresso'), |
|
394 | 394 | 'filename' => 'events_default_settings', |
395 | 395 | ), |
396 | 396 | 'default_settings_status_help_tab' => array( |
397 | - 'title' => esc_html__( 'Default Registration Status', 'event_espresso' ), |
|
397 | + 'title' => esc_html__('Default Registration Status', 'event_espresso'), |
|
398 | 398 | 'filename' => 'events_default_settings_status', |
399 | 399 | ), |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour' ), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => false, |
403 | 403 | ), |
404 | 404 | //template settings |
405 | 405 | 'template_settings' => array( |
406 | 406 | 'nav' => array( |
407 | - 'label' => esc_html__( 'Templates', 'event_espresso' ), |
|
407 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
408 | 408 | 'order' => 30, |
409 | 409 | ), |
410 | 410 | 'metaboxes' => $this->_default_espresso_metaboxes, |
411 | 411 | 'help_tabs' => array( |
412 | 412 | 'general_settings_templates_help_tab' => array( |
413 | - 'title' => esc_html__( 'Templates', 'event_espresso' ), |
|
413 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
414 | 414 | 'filename' => 'general_settings_templates', |
415 | 415 | ), |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => false, |
419 | 419 | ), |
420 | 420 | //event category stuff |
421 | 421 | 'add_category' => array( |
422 | 422 | 'nav' => array( |
423 | - 'label' => esc_html__( 'Add Category', 'event_espresso' ), |
|
423 | + 'label' => esc_html__('Add Category', 'event_espresso'), |
|
424 | 424 | 'order' => 15, |
425 | 425 | 'persistent' => false, |
426 | 426 | ), |
427 | 427 | 'help_tabs' => array( |
428 | 428 | 'add_category_help_tab' => array( |
429 | - 'title' => esc_html__( 'Add New Event Category', 'event_espresso' ), |
|
429 | + 'title' => esc_html__('Add New Event Category', 'event_espresso'), |
|
430 | 430 | 'filename' => 'events_add_category', |
431 | 431 | ), |
432 | 432 | ), |
433 | - 'help_tour' => array( 'Event_Add_Category_Help_Tour' ), |
|
434 | - 'metaboxes' => array( '_publish_post_box' ), |
|
433 | + 'help_tour' => array('Event_Add_Category_Help_Tour'), |
|
434 | + 'metaboxes' => array('_publish_post_box'), |
|
435 | 435 | 'require_nonce' => false, |
436 | 436 | ), |
437 | 437 | 'edit_category' => array( |
438 | 438 | 'nav' => array( |
439 | - 'label' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
439 | + 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
440 | 440 | 'order' => 15, |
441 | 441 | 'persistent' => false, |
442 | - 'url' => isset( $this->_req_data['EVT_CAT_ID'] ) |
|
442 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) |
|
443 | 443 | ? add_query_arg( |
444 | - array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), |
|
444 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
445 | 445 | $this->_current_page_view_url |
446 | 446 | ) |
447 | 447 | : $this->_admin_base_url, |
448 | 448 | ), |
449 | 449 | 'help_tabs' => array( |
450 | 450 | 'edit_category_help_tab' => array( |
451 | - 'title' => esc_html__( 'Edit Event Category', 'event_espresso' ), |
|
451 | + 'title' => esc_html__('Edit Event Category', 'event_espresso'), |
|
452 | 452 | 'filename' => 'events_edit_category', |
453 | 453 | ), |
454 | 454 | ), |
455 | 455 | /*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/ |
456 | - 'metaboxes' => array( '_publish_post_box' ), |
|
456 | + 'metaboxes' => array('_publish_post_box'), |
|
457 | 457 | 'require_nonce' => false, |
458 | 458 | ), |
459 | 459 | 'category_list' => array( |
460 | 460 | 'nav' => array( |
461 | - 'label' => esc_html__( 'Categories', 'event_espresso' ), |
|
461 | + 'label' => esc_html__('Categories', 'event_espresso'), |
|
462 | 462 | 'order' => 20, |
463 | 463 | ), |
464 | 464 | 'list_table' => 'Event_Categories_Admin_List_Table', |
465 | 465 | 'help_tabs' => array( |
466 | 466 | 'events_categories_help_tab' => array( |
467 | - 'title' => esc_html__( 'Event Categories', 'event_espresso' ), |
|
467 | + 'title' => esc_html__('Event Categories', 'event_espresso'), |
|
468 | 468 | 'filename' => 'events_categories', |
469 | 469 | ), |
470 | 470 | 'events_categories_table_column_headings_help_tab' => array( |
471 | - 'title' => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ), |
|
471 | + 'title' => esc_html__('Event Categories Table Column Headings', 'event_espresso'), |
|
472 | 472 | 'filename' => 'events_categories_table_column_headings', |
473 | 473 | ), |
474 | 474 | 'events_categories_view_help_tab' => array( |
475 | - 'title' => esc_html__( 'Event Categories Views', 'event_espresso' ), |
|
475 | + 'title' => esc_html__('Event Categories Views', 'event_espresso'), |
|
476 | 476 | 'filename' => 'events_categories_views', |
477 | 477 | ), |
478 | 478 | 'events_categories_other_help_tab' => array( |
479 | - 'title' => esc_html__( 'Event Categories Other', 'event_espresso' ), |
|
479 | + 'title' => esc_html__('Event Categories Other', 'event_espresso'), |
|
480 | 480 | 'filename' => 'events_categories_other', |
481 | 481 | ), |
482 | 482 | ), |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | protected function _add_screen_options_category_list() { |
507 | 507 | $page_title = $this->_admin_page_title; |
508 | - $this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' ); |
|
508 | + $this->_admin_page_title = esc_html__('Categories', 'event_espresso'); |
|
509 | 509 | $this->_per_page_screen_option(); |
510 | 510 | $this->_admin_page_title = $page_title; |
511 | 511 | } |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | public function load_scripts_styles() { |
522 | 522 | wp_register_style( |
523 | 523 | 'events-admin-css', |
524 | - EVENTS_ASSETS_URL . 'events-admin-page.css', |
|
524 | + EVENTS_ASSETS_URL.'events-admin-page.css', |
|
525 | 525 | array(), |
526 | 526 | EVENT_ESPRESSO_VERSION |
527 | 527 | ); |
528 | - wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
529 | - wp_enqueue_style( 'events-admin-css' ); |
|
530 | - wp_enqueue_style( 'ee-cat-admin' ); |
|
528 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
529 | + wp_enqueue_style('events-admin-css'); |
|
530 | + wp_enqueue_style('ee-cat-admin'); |
|
531 | 531 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
532 | 532 | //registers for all views |
533 | 533 | //scripts |
534 | 534 | wp_register_script( |
535 | 535 | 'event_editor_js', |
536 | - EVENTS_ASSETS_URL . 'event_editor.js', |
|
537 | - array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ), |
|
536 | + EVENTS_ASSETS_URL.'event_editor.js', |
|
537 | + array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), |
|
538 | 538 | EVENT_ESPRESSO_VERSION, |
539 | 539 | true |
540 | 540 | ); |
@@ -560,22 +560,22 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function load_scripts_styles_edit() { |
562 | 562 | //styles |
563 | - wp_enqueue_style( 'espresso-ui-theme' ); |
|
563 | + wp_enqueue_style('espresso-ui-theme'); |
|
564 | 564 | wp_register_style( |
565 | 565 | 'event-editor-css', |
566 | - EVENTS_ASSETS_URL . 'event-editor.css', |
|
567 | - array( 'ee-admin-css' ), |
|
566 | + EVENTS_ASSETS_URL.'event-editor.css', |
|
567 | + array('ee-admin-css'), |
|
568 | 568 | EVENT_ESPRESSO_VERSION |
569 | 569 | ); |
570 | - wp_enqueue_style( 'event-editor-css' ); |
|
570 | + wp_enqueue_style('event-editor-css'); |
|
571 | 571 | //scripts |
572 | 572 | wp_register_script( |
573 | 573 | 'event-datetime-metabox', |
574 | - EVENTS_ASSETS_URL . 'event-datetime-metabox.js', |
|
575 | - array( 'event_editor_js', 'ee-datepicker' ), |
|
574 | + EVENTS_ASSETS_URL.'event-datetime-metabox.js', |
|
575 | + array('event_editor_js', 'ee-datepicker'), |
|
576 | 576 | EVENT_ESPRESSO_VERSION |
577 | 577 | ); |
578 | - wp_enqueue_script( 'event-datetime-metabox' ); |
|
578 | + wp_enqueue_script('event-datetime-metabox'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $this->_views = array( |
596 | 596 | 'all' => array( |
597 | 597 | 'slug' => 'all', |
598 | - 'label' => esc_html__( 'All', 'event_espresso' ), |
|
598 | + 'label' => esc_html__('All', 'event_espresso'), |
|
599 | 599 | 'count' => 0, |
600 | 600 | 'bulk_action' => array( |
601 | - 'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
601 | + 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
602 | 602 | ), |
603 | 603 | ), |
604 | 604 | ); |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | * @access public |
635 | 635 | * @return void |
636 | 636 | */ |
637 | - public function verify_event_edit( $event = null ) { |
|
637 | + public function verify_event_edit($event = null) { |
|
638 | 638 | // no event? |
639 | - if ( empty( $event ) ) { |
|
639 | + if (empty($event)) { |
|
640 | 640 | // set event |
641 | 641 | $event = $this->_cpt_model_obj; |
642 | 642 | } |
643 | 643 | // STILL no event? |
644 | - if ( empty ( $event ) ) { |
|
644 | + if (empty ($event)) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | $orig_status = $event->status(); |
@@ -655,32 +655,32 @@ discard block |
||
655 | 655 | return; |
656 | 656 | } |
657 | 657 | //made it here so it IS active... next check that any of the tickets are sold. |
658 | - if ( $event->is_sold_out( true ) ) { |
|
659 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
658 | + if ($event->is_sold_out(true)) { |
|
659 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
660 | 660 | EE_Error::add_attention( |
661 | 661 | sprintf( |
662 | 662 | esc_html__( |
663 | 663 | 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', |
664 | 664 | 'event_espresso' |
665 | 665 | ), |
666 | - EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' ) |
|
666 | + EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence') |
|
667 | 667 | ) |
668 | 668 | ); |
669 | 669 | } |
670 | 670 | return; |
671 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
671 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
672 | 672 | EE_Error::add_attention( |
673 | 673 | sprintf( |
674 | 674 | esc_html__( |
675 | 675 | 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
676 | 676 | 'event_espresso' |
677 | 677 | ), |
678 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
678 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
679 | 679 | ) |
680 | 680 | ); |
681 | 681 | } |
682 | 682 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
683 | - if ( ! $event->tickets_on_sale() ) { |
|
683 | + if ( ! $event->tickets_on_sale()) { |
|
684 | 684 | return; |
685 | 685 | } |
686 | 686 | //made it here so show warning |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | protected function _edit_event_warning() { |
700 | 700 | // we don't want to add warnings during these requests |
701 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
701 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
702 | 702 | return; |
703 | 703 | } |
704 | 704 | EE_Error::add_attention( |
@@ -717,14 +717,14 @@ discard block |
||
717 | 717 | * @return string |
718 | 718 | */ |
719 | 719 | protected function _create_new_cpt_item() { |
720 | - $gmt_offset = get_option( 'gmt_offset' ); |
|
720 | + $gmt_offset = get_option('gmt_offset'); |
|
721 | 721 | //only nag them about setting their timezone if it's their first event, and they haven't already done it |
722 | - if( $gmt_offset === '0' && ! EEM_Event::instance()->exists(array()) ) { |
|
722 | + if ($gmt_offset === '0' && ! EEM_Event::instance()->exists(array())) { |
|
723 | 723 | EE_Error::add_attention( |
724 | 724 | sprintf( |
725 | - __( 'Your website\'s timezone is currently set to UTC + 0. We recommend updating your timezone to a city |
|
725 | + __('Your website\'s timezone is currently set to UTC + 0. We recommend updating your timezone to a city |
|
726 | 726 | or region near you before you create an event. Your timezone can be updated through the %1$sGeneral Settings%2$s page.'), |
727 | - '<a href="' . admin_url( 'options-general.php' ) . '">', |
|
727 | + '<a href="'.admin_url('options-general.php').'">', |
|
728 | 728 | '</a>' |
729 | 729 | ), |
730 | 730 | __FILE__, |
@@ -741,29 +741,29 @@ discard block |
||
741 | 741 | $this->_views = array( |
742 | 742 | 'all' => array( |
743 | 743 | 'slug' => 'all', |
744 | - 'label' => esc_html__( 'View All Events', 'event_espresso' ), |
|
744 | + 'label' => esc_html__('View All Events', 'event_espresso'), |
|
745 | 745 | 'count' => 0, |
746 | 746 | 'bulk_action' => array( |
747 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
747 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
748 | 748 | ), |
749 | 749 | ), |
750 | 750 | 'draft' => array( |
751 | 751 | 'slug' => 'draft', |
752 | - 'label' => esc_html__( 'Draft', 'event_espresso' ), |
|
752 | + 'label' => esc_html__('Draft', 'event_espresso'), |
|
753 | 753 | 'count' => 0, |
754 | 754 | 'bulk_action' => array( |
755 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
755 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
756 | 756 | ), |
757 | 757 | ), |
758 | 758 | ); |
759 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
759 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
760 | 760 | $this->_views['trash'] = array( |
761 | 761 | 'slug' => 'trash', |
762 | - 'label' => esc_html__( 'Trash', 'event_espresso' ), |
|
762 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
763 | 763 | 'count' => 0, |
764 | 764 | 'bulk_action' => array( |
765 | - 'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ), |
|
766 | - 'delete_events' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
765 | + 'restore_events' => esc_html__('Restore From Trash', 'event_espresso'), |
|
766 | + 'delete_events' => esc_html__('Delete Permanently', 'event_espresso'), |
|
767 | 767 | ), |
768 | 768 | ); |
769 | 769 | } |
@@ -778,50 +778,50 @@ discard block |
||
778 | 778 | $items = array( |
779 | 779 | 'view_details' => array( |
780 | 780 | 'class' => 'dashicons dashicons-search', |
781 | - 'desc' => esc_html__( 'View Event', 'event_espresso' ), |
|
781 | + 'desc' => esc_html__('View Event', 'event_espresso'), |
|
782 | 782 | ), |
783 | 783 | 'edit_event' => array( |
784 | 784 | 'class' => 'ee-icon ee-icon-calendar-edit', |
785 | - 'desc' => esc_html__( 'Edit Event Details', 'event_espresso' ), |
|
785 | + 'desc' => esc_html__('Edit Event Details', 'event_espresso'), |
|
786 | 786 | ), |
787 | 787 | 'view_attendees' => array( |
788 | 788 | 'class' => 'dashicons dashicons-groups', |
789 | - 'desc' => esc_html__( 'View Registrations for Event', 'event_espresso' ), |
|
789 | + 'desc' => esc_html__('View Registrations for Event', 'event_espresso'), |
|
790 | 790 | ), |
791 | 791 | ); |
792 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
792 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
793 | 793 | $statuses = array( |
794 | 794 | 'sold_out_status' => array( |
795 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
796 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ), |
|
795 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
796 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'), |
|
797 | 797 | ), |
798 | 798 | 'active_status' => array( |
799 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
800 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ), |
|
799 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
800 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'), |
|
801 | 801 | ), |
802 | 802 | 'upcoming_status' => array( |
803 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
804 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ), |
|
803 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
804 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'), |
|
805 | 805 | ), |
806 | 806 | 'postponed_status' => array( |
807 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
808 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ), |
|
807 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
808 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'), |
|
809 | 809 | ), |
810 | 810 | 'cancelled_status' => array( |
811 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
812 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ), |
|
811 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
812 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'), |
|
813 | 813 | ), |
814 | 814 | 'expired_status' => array( |
815 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
816 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ), |
|
815 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
816 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'), |
|
817 | 817 | ), |
818 | 818 | 'inactive_status' => array( |
819 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
820 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ), |
|
819 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
820 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'), |
|
821 | 821 | ), |
822 | 822 | ); |
823 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
824 | - return array_merge( $items, $statuses ); |
|
823 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
824 | + return array_merge($items, $statuses); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | |
@@ -832,8 +832,8 @@ discard block |
||
832 | 832 | * @return EEM_Event |
833 | 833 | */ |
834 | 834 | private function _event_model() { |
835 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
836 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
835 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
836 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
837 | 837 | } |
838 | 838 | return $this->_event_model; |
839 | 839 | } |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | * @param string $new_slug what the slug is |
851 | 851 | * @return string The new html string for the permalink area |
852 | 852 | */ |
853 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
853 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
854 | 854 | //make sure this is only when editing |
855 | - if ( ! empty( $id ) ) { |
|
856 | - $post = get_post( $id ); |
|
855 | + if ( ! empty($id)) { |
|
856 | + $post = get_post($id); |
|
857 | 857 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
858 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
858 | + . esc_html__('Shortcode', 'event_espresso') |
|
859 | 859 | . '</a> '; |
860 | 860 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
861 | 861 | . $post->ID |
@@ -874,14 +874,14 @@ discard block |
||
874 | 874 | * @return void |
875 | 875 | */ |
876 | 876 | protected function _events_overview_list_table() { |
877 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
877 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
878 | 878 | $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
879 | - get_post_type_archive_link( 'espresso_events' ), |
|
880 | - esc_html__( "View Event Archive Page", "event_espresso" ), |
|
879 | + get_post_type_archive_link('espresso_events'), |
|
880 | + esc_html__("View Event Archive Page", "event_espresso"), |
|
881 | 881 | 'button' |
882 | 882 | ); |
883 | - $this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() ); |
|
884 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
883 | + $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
884 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
885 | 885 | 'create_new', |
886 | 886 | 'add', |
887 | 887 | array(), |
@@ -907,48 +907,48 @@ discard block |
||
907 | 907 | * @param string $post_id |
908 | 908 | * @param object $post |
909 | 909 | */ |
910 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
911 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
910 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
911 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
912 | 912 | //get out we're not processing an event save. |
913 | 913 | return; |
914 | 914 | } |
915 | 915 | $event_values = array( |
916 | - 'EVT_display_desc' => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
917 | - 'EVT_display_ticket_selector' => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
916 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
917 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
918 | 918 | 'EVT_additional_limit' => min( |
919 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
920 | - ! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null |
|
919 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
920 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null |
|
921 | 921 | ), |
922 | - 'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] ) |
|
922 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) |
|
923 | 923 | ? $this->_req_data['EVT_default_registration_status'] |
924 | 924 | : EE_Registry::instance()->CFG->registration->default_STS_ID, |
925 | - 'EVT_member_only' => ! empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
926 | - 'EVT_allow_overflow' => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
927 | - 'EVT_timezone_string' => ! empty( $this->_req_data['timezone_string'] ) |
|
925 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
926 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
927 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) |
|
928 | 928 | ? $this->_req_data['timezone_string'] : null, |
929 | - 'EVT_external_URL' => ! empty( $this->_req_data['externalURL'] ) |
|
929 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) |
|
930 | 930 | ? $this->_req_data['externalURL'] : null, |
931 | - 'EVT_phone' => ! empty( $this->_req_data['event_phone'] ) |
|
931 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) |
|
932 | 932 | ? $this->_req_data['event_phone'] : null, |
933 | 933 | ); |
934 | 934 | //update event |
935 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
935 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
936 | 936 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
937 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
938 | - $event = $this->_event_model()->get_one( array( $get_one_where ) ); |
|
937 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
938 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
939 | 939 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
940 | 940 | $event_update_callbacks = apply_filters( |
941 | 941 | 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
942 | - array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) ) |
|
942 | + array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')) |
|
943 | 943 | ); |
944 | 944 | $att_success = true; |
945 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
946 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
945 | + foreach ($event_update_callbacks as $e_callback) { |
|
946 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
947 | 947 | $att_success = ! $att_success ? $att_success |
948 | 948 | : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
949 | 949 | } |
950 | 950 | //any errors? |
951 | - if ( $success && false === $att_success ) { |
|
951 | + if ($success && false === $att_success) { |
|
952 | 952 | EE_Error::add_error( |
953 | 953 | esc_html__( |
954 | 954 | 'Event Details saved successfully but something went wrong with saving attachments.', |
@@ -958,9 +958,9 @@ discard block |
||
958 | 958 | __FUNCTION__, |
959 | 959 | __LINE__ |
960 | 960 | ); |
961 | - } else if ( $success === false ) { |
|
961 | + } else if ($success === false) { |
|
962 | 962 | EE_Error::add_error( |
963 | - esc_html__( 'Event Details did not save successfully.', 'event_espresso' ), |
|
963 | + esc_html__('Event Details did not save successfully.', 'event_espresso'), |
|
964 | 964 | __FILE__, |
965 | 965 | __FUNCTION__, |
966 | 966 | __LINE__ |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | * @param int $post_id |
976 | 976 | * @param int $revision_id |
977 | 977 | */ |
978 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
978 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
979 | 979 | //copy existing event meta to new post |
980 | - $post_evt = $this->_event_model()->get_one_by_ID( $post_id ); |
|
981 | - if ( $post_evt instanceof EE_Event ) { |
|
980 | + $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
|
981 | + if ($post_evt instanceof EE_Event) { |
|
982 | 982 | //meta revision restore |
983 | - $post_evt->restore_revision( $revision_id ); |
|
983 | + $post_evt->restore_revision($revision_id); |
|
984 | 984 | //related objs restore |
985 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
985 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
986 | 986 | } |
987 | 987 | } |
988 | 988 | |
@@ -995,49 +995,49 @@ discard block |
||
995 | 995 | * @param array $data The request data from the form |
996 | 996 | * @return bool Success or fail. |
997 | 997 | */ |
998 | - protected function _default_venue_update( \EE_Event $evtobj, $data ) { |
|
999 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
1000 | - $venue_model = EE_Registry::instance()->load_model( 'Venue' ); |
|
998 | + protected function _default_venue_update(\EE_Event $evtobj, $data) { |
|
999 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
1000 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
1001 | 1001 | $rows_affected = null; |
1002 | - $venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null; |
|
1002 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
1003 | 1003 | // very important. If we don't have a venue name... |
1004 | 1004 | // then we'll get out because not necessary to create empty venue |
1005 | - if ( empty( $data['venue_title'] ) ) { |
|
1005 | + if (empty($data['venue_title'])) { |
|
1006 | 1006 | return false; |
1007 | 1007 | } |
1008 | 1008 | $venue_array = array( |
1009 | - 'VNU_wp_user' => $evtobj->get( 'EVT_wp_user' ), |
|
1010 | - 'VNU_name' => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null, |
|
1011 | - 'VNU_desc' => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null, |
|
1012 | - 'VNU_identifier' => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null, |
|
1013 | - 'VNU_short_desc' => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description'] |
|
1009 | + 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
|
1010 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : null, |
|
1011 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : null, |
|
1012 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null, |
|
1013 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] |
|
1014 | 1014 | : null, |
1015 | - 'VNU_address' => ! empty( $data['address'] ) ? $data['address'] : null, |
|
1016 | - 'VNU_address2' => ! empty( $data['address2'] ) ? $data['address2'] : null, |
|
1017 | - 'VNU_city' => ! empty( $data['city'] ) ? $data['city'] : null, |
|
1018 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : null, |
|
1019 | - 'CNT_ISO' => ! empty( $data['countries'] ) ? $data['countries'] : null, |
|
1020 | - 'VNU_zip' => ! empty( $data['zip'] ) ? $data['zip'] : null, |
|
1021 | - 'VNU_phone' => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null, |
|
1022 | - 'VNU_capacity' => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null, |
|
1023 | - 'VNU_url' => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null, |
|
1024 | - 'VNU_virtual_phone' => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null, |
|
1025 | - 'VNU_virtual_url' => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null, |
|
1026 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
1015 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : null, |
|
1016 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : null, |
|
1017 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : null, |
|
1018 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : null, |
|
1019 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : null, |
|
1020 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : null, |
|
1021 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : null, |
|
1022 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null, |
|
1023 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : null, |
|
1024 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null, |
|
1025 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : null, |
|
1026 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
1027 | 1027 | 'status' => 'publish', |
1028 | 1028 | ); |
1029 | 1029 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
1030 | - if ( ! empty( $venue_id ) ) { |
|
1031 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
1032 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
1030 | + if ( ! empty($venue_id)) { |
|
1031 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
1032 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
1033 | 1033 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
1034 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1034 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1035 | 1035 | return $rows_affected > 0 ? true : false; |
1036 | 1036 | } else { |
1037 | 1037 | //we insert the venue |
1038 | - $venue_id = $venue_model->insert( $venue_array ); |
|
1039 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1040 | - return ! empty( $venue_id ) ? true : false; |
|
1038 | + $venue_id = $venue_model->insert($venue_array); |
|
1039 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1040 | + return ! empty($venue_id) ? true : false; |
|
1041 | 1041 | } |
1042 | 1042 | //when we have the ancestor come in it's already been handled by the revision save. |
1043 | 1043 | } |
@@ -1051,51 +1051,51 @@ discard block |
||
1051 | 1051 | * @param array $data The request data from the form |
1052 | 1052 | * @return array |
1053 | 1053 | */ |
1054 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
1054 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
1055 | 1055 | $success = true; |
1056 | 1056 | $saved_dtt = null; |
1057 | 1057 | $saved_tickets = array(); |
1058 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1059 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
1058 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1059 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
1060 | 1060 | //trim all values to ensure any excess whitespace is removed. |
1061 | - $dtt = array_map( 'trim', $dtt ); |
|
1062 | - $dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] |
|
1061 | + $dtt = array_map('trim', $dtt); |
|
1062 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] |
|
1063 | 1063 | : $dtt['DTT_EVT_start']; |
1064 | 1064 | $datetime_values = array( |
1065 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null, |
|
1065 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
1066 | 1066 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
1067 | 1067 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
1068 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1068 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1069 | 1069 | 'DTT_order' => $row, |
1070 | 1070 | ); |
1071 | 1071 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1072 | - if ( ! empty( $dtt['DTT_ID'] ) ) { |
|
1072 | + if ( ! empty($dtt['DTT_ID'])) { |
|
1073 | 1073 | $DTM = EE_Registry::instance() |
1074 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1075 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1076 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1077 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1078 | - foreach ( $datetime_values as $field => $value ) { |
|
1079 | - $DTM->set( $field, $value ); |
|
1074 | + ->load_model('Datetime', array($evtobj->get_timezone())) |
|
1075 | + ->get_one_by_ID($dtt['DTT_ID']); |
|
1076 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1077 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1078 | + foreach ($datetime_values as $field => $value) { |
|
1079 | + $DTM->set($field, $value); |
|
1080 | 1080 | } |
1081 | 1081 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
1082 | - $saved_dtts[ $DTM->ID() ] = $DTM; |
|
1082 | + $saved_dtts[$DTM->ID()] = $DTM; |
|
1083 | 1083 | } else { |
1084 | - $DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false ); |
|
1085 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1086 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1087 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
1088 | - foreach ( $datetime_values as $field => $value ) { |
|
1089 | - $DTM->set( $field, $value ); |
|
1084 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false); |
|
1085 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1086 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1087 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
1088 | + foreach ($datetime_values as $field => $value) { |
|
1089 | + $DTM->set($field, $value); |
|
1090 | 1090 | } |
1091 | 1091 | } |
1092 | 1092 | $DTM->save(); |
1093 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
1093 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
1094 | 1094 | //load DTT helper |
1095 | 1095 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1096 | - if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) { |
|
1097 | - $DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) ); |
|
1098 | - $DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' ); |
|
1096 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
1097 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
1098 | + $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
|
1099 | 1099 | $DTT->save(); |
1100 | 1100 | } |
1101 | 1101 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
@@ -1106,20 +1106,20 @@ discard block |
||
1106 | 1106 | } |
1107 | 1107 | //no dtts get deleted so we don't do any of that logic here. |
1108 | 1108 | //update tickets next |
1109 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array(); |
|
1110 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1111 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1109 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1110 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1111 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1112 | 1112 | $update_prices = false; |
1113 | - $ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] ) |
|
1114 | - ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0; |
|
1113 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) |
|
1114 | + ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1115 | 1115 | // trim inputs to ensure any excess whitespace is removed. |
1116 | - $tkt = array_map( 'trim', $tkt ); |
|
1117 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1116 | + $tkt = array_map('trim', $tkt); |
|
1117 | + if (empty($tkt['TKT_start_date'])) { |
|
1118 | 1118 | //let's use now in the set timezone. |
1119 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1120 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1119 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1120 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1121 | 1121 | } |
1122 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1122 | + if (empty($tkt['TKT_end_date'])) { |
|
1123 | 1123 | //use the start date of the first datetime |
1124 | 1124 | $dtt = $evtobj->first_datetime(); |
1125 | 1125 | $tkt['TKT_end_date'] = $dtt->start_date_and_time( |
@@ -1128,22 +1128,22 @@ discard block |
||
1128 | 1128 | ); |
1129 | 1129 | } |
1130 | 1130 | $TKT_values = array( |
1131 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null, |
|
1132 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1133 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1134 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1131 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
1132 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1133 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1134 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1135 | 1135 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1136 | 1136 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1137 | - 'TKT_qty' => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1138 | - 'TKT_uses' => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1139 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1140 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1137 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1138 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1139 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1140 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1141 | 1141 | 'TKT_row' => $row, |
1142 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1142 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1143 | 1143 | 'TKT_price' => $ticket_price, |
1144 | 1144 | ); |
1145 | 1145 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1146 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1146 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1147 | 1147 | $TKT_values['TKT_ID'] = 0; |
1148 | 1148 | $TKT_values['TKT_is_default'] = 0; |
1149 | 1149 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1152,110 +1152,110 @@ discard block |
||
1152 | 1152 | //if we have a TKT_ID then we need to get that existing TKT_obj and update it |
1153 | 1153 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1154 | 1154 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1155 | - if ( ! empty( $tkt['TKT_ID'] ) ) { |
|
1155 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1156 | 1156 | $TKT = EE_Registry::instance() |
1157 | - ->load_model( 'Ticket', array( $evtobj->get_timezone() ) ) |
|
1158 | - ->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1159 | - if ( $TKT instanceof EE_Ticket ) { |
|
1157 | + ->load_model('Ticket', array($evtobj->get_timezone())) |
|
1158 | + ->get_one_by_ID($tkt['TKT_ID']); |
|
1159 | + if ($TKT instanceof EE_Ticket) { |
|
1160 | 1160 | $ticket_sold = $TKT->count_related( |
1161 | 1161 | 'Registration', |
1162 | 1162 | array( |
1163 | 1163 | array( |
1164 | 1164 | 'STS_ID' => array( |
1165 | 1165 | 'NOT IN', |
1166 | - array( EEM_Registration::status_id_incomplete ), |
|
1166 | + array(EEM_Registration::status_id_incomplete), |
|
1167 | 1167 | ), |
1168 | 1168 | ), |
1169 | 1169 | ) |
1170 | 1170 | ) > 0 ? true : false; |
1171 | 1171 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1172 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
|
1172 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') |
|
1173 | 1173 | && ! $TKT->get( |
1174 | 1174 | 'TKT_deleted' |
1175 | 1175 | ) ? true : false; |
1176 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1177 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1176 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1177 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1178 | 1178 | //set new values |
1179 | - foreach ( $TKT_values as $field => $value ) { |
|
1180 | - if ( $field == 'TKT_qty' ) { |
|
1181 | - $TKT->set_qty( $value ); |
|
1179 | + foreach ($TKT_values as $field => $value) { |
|
1180 | + if ($field == 'TKT_qty') { |
|
1181 | + $TKT->set_qty($value); |
|
1182 | 1182 | } else { |
1183 | - $TKT->set( $field, $value ); |
|
1183 | + $TKT->set($field, $value); |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1187 | - if ( $create_new_TKT ) { |
|
1187 | + if ($create_new_TKT) { |
|
1188 | 1188 | //archive the old ticket first |
1189 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1189 | + $TKT->set('TKT_deleted', 1); |
|
1190 | 1190 | $TKT->save(); |
1191 | 1191 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1192 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1192 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1193 | 1193 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1194 | 1194 | $TKT = clone $TKT; |
1195 | - $TKT->set( 'TKT_ID', 0 ); |
|
1196 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1197 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1198 | - $TKT->set( 'TKT_sold', 0 ); |
|
1195 | + $TKT->set('TKT_ID', 0); |
|
1196 | + $TKT->set('TKT_deleted', 0); |
|
1197 | + $TKT->set('TKT_price', $ticket_price); |
|
1198 | + $TKT->set('TKT_sold', 0); |
|
1199 | 1199 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1200 | 1200 | $update_prices = true; |
1201 | 1201 | } |
1202 | 1202 | //make sure price is set if it hasn't been already |
1203 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1203 | + $TKT->set('TKT_price', $ticket_price); |
|
1204 | 1204 | } |
1205 | 1205 | } else { |
1206 | 1206 | //no TKT_id so a new TKT |
1207 | 1207 | $TKT_values['TKT_price'] = $ticket_price; |
1208 | - $TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false ); |
|
1209 | - if ( $TKT instanceof EE_Ticket ) { |
|
1208 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false); |
|
1209 | + if ($TKT instanceof EE_Ticket) { |
|
1210 | 1210 | //need to reset values to properly account for the date formats |
1211 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1212 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1213 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1211 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1212 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1213 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1214 | 1214 | //set new values |
1215 | - foreach ( $TKT_values as $field => $value ) { |
|
1216 | - if ( $field == 'TKT_qty' ) { |
|
1217 | - $TKT->set_qty( $value ); |
|
1215 | + foreach ($TKT_values as $field => $value) { |
|
1216 | + if ($field == 'TKT_qty') { |
|
1217 | + $TKT->set_qty($value); |
|
1218 | 1218 | } else { |
1219 | - $TKT->set( $field, $value ); |
|
1219 | + $TKT->set($field, $value); |
|
1220 | 1220 | } |
1221 | 1221 | } |
1222 | 1222 | $update_prices = true; |
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | // cap ticket qty by datetime reg limits |
1226 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1226 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1227 | 1227 | //update ticket. |
1228 | 1228 | $TKT->save(); |
1229 | 1229 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1230 | - if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) { |
|
1231 | - $TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) ); |
|
1232 | - $TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' ); |
|
1230 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1231 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1232 | + $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
1233 | 1233 | $TKT->save(); |
1234 | 1234 | } |
1235 | 1235 | //initially let's add the ticket to the dtt |
1236 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1237 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1236 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1237 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1238 | 1238 | //add prices to ticket |
1239 | - $this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices ); |
|
1239 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1240 | 1240 | } |
1241 | 1241 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1242 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1243 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1244 | - foreach ( $tickets_removed as $id ) { |
|
1245 | - $id = absint( $id ); |
|
1242 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1243 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1244 | + foreach ($tickets_removed as $id) { |
|
1245 | + $id = absint($id); |
|
1246 | 1246 | //get the ticket for this id |
1247 | - $tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id ); |
|
1247 | + $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
1248 | 1248 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1249 | - $dtts = $tkt_to_remove->get_many_related( 'Datetime' ); |
|
1250 | - foreach ( $dtts as $dtt ) { |
|
1251 | - $tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' ); |
|
1249 | + $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
1250 | + foreach ($dtts as $dtt) { |
|
1251 | + $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
1252 | 1252 | } |
1253 | 1253 | //need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
1254 | - $tkt_to_remove->delete_related_permanently( 'Price' ); |
|
1254 | + $tkt_to_remove->delete_related_permanently('Price'); |
|
1255 | 1255 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1256 | 1256 | $tkt_to_remove->delete_permanently(); |
1257 | 1257 | } |
1258 | - return array( $saved_dtt, $saved_tickets ); |
|
1258 | + return array($saved_dtt, $saved_tickets); |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | |
@@ -1272,29 +1272,29 @@ discard block |
||
1272 | 1272 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1273 | 1273 | * @return void |
1274 | 1274 | */ |
1275 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) { |
|
1276 | - foreach ( $prices as $row => $prc ) { |
|
1275 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) { |
|
1276 | + foreach ($prices as $row => $prc) { |
|
1277 | 1277 | $PRC_values = array( |
1278 | - 'PRC_ID' => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null, |
|
1279 | - 'PRT_ID' => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null, |
|
1280 | - 'PRC_amount' => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1281 | - 'PRC_name' => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1282 | - 'PRC_desc' => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1278 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
1279 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null, |
|
1280 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1281 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1282 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1283 | 1283 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1284 | 1284 | 'PRC_order' => $row, |
1285 | 1285 | ); |
1286 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1286 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1287 | 1287 | $PRC_values['PRC_ID'] = 0; |
1288 | - $PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false ); |
|
1288 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
1289 | 1289 | } else { |
1290 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1290 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1291 | 1291 | //update this price with new values |
1292 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1293 | - $PRC->set( $field, $newprc ); |
|
1292 | + foreach ($PRC_values as $field => $newprc) { |
|
1293 | + $PRC->set($field, $newprc); |
|
1294 | 1294 | } |
1295 | 1295 | $PRC->save(); |
1296 | 1296 | } |
1297 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1297 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1298 | 1298 | } |
1299 | 1299 | } |
1300 | 1300 | |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | private function _generate_publish_box_extra_content() { |
1327 | 1327 | //load formatter helper |
1328 | 1328 | //args for getting related registrations |
1329 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1329 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1330 | 1330 | $not_approved_query_args = array( |
1331 | 1331 | array( |
1332 | 1332 | 'REG_deleted' => 0, |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
1398 | 1398 | // load template |
1399 | 1399 | EEH_Template::display_template( |
1400 | - EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', |
|
1400 | + EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', |
|
1401 | 1401 | $publish_box_extra_args |
1402 | 1402 | ); |
1403 | 1403 | } |
@@ -1431,16 +1431,16 @@ discard block |
||
1431 | 1431 | $this->verify_cpt_object(); |
1432 | 1432 | add_meta_box( |
1433 | 1433 | 'espresso_event_editor_tickets', |
1434 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1435 | - array( $this, 'ticket_metabox' ), |
|
1434 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1435 | + array($this, 'ticket_metabox'), |
|
1436 | 1436 | $this->page_slug, |
1437 | 1437 | 'normal', |
1438 | 1438 | 'high' |
1439 | 1439 | ); |
1440 | 1440 | add_meta_box( |
1441 | 1441 | 'espresso_event_editor_event_options', |
1442 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1443 | - array( $this, 'registration_options_meta_box' ), |
|
1442 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1443 | + array($this, 'registration_options_meta_box'), |
|
1444 | 1444 | $this->page_slug, |
1445 | 1445 | 'side', |
1446 | 1446 | 'default' |
@@ -1468,65 +1468,65 @@ discard block |
||
1468 | 1468 | 'trash_icon' => 'ee-lock-icon', |
1469 | 1469 | 'disabled' => '', |
1470 | 1470 | ); |
1471 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null; |
|
1472 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1471 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null; |
|
1472 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1473 | 1473 | /** |
1474 | 1474 | * 1. Start with retrieving Datetimes |
1475 | 1475 | * 2. Fore each datetime get related tickets |
1476 | 1476 | * 3. For each ticket get related prices |
1477 | 1477 | */ |
1478 | - $times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id ); |
|
1478 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1479 | 1479 | /** @type EE_Datetime $first_datetime */ |
1480 | - $first_datetime = reset( $times ); |
|
1480 | + $first_datetime = reset($times); |
|
1481 | 1481 | //do we get related tickets? |
1482 | - if ( $first_datetime instanceof EE_Datetime |
|
1482 | + if ($first_datetime instanceof EE_Datetime |
|
1483 | 1483 | && $first_datetime->ID() !== 0 |
1484 | 1484 | ) { |
1485 | - $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
|
1485 | + $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
|
1486 | 1486 | $template_args['time'] = $first_datetime; |
1487 | 1487 | $related_tickets = $first_datetime->tickets( |
1488 | 1488 | array( |
1489 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1489 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1490 | 1490 | 'default_where_conditions' => 'none', |
1491 | 1491 | ) |
1492 | 1492 | ); |
1493 | - if ( ! empty( $related_tickets ) ) { |
|
1494 | - $template_args['total_ticket_rows'] = count( $related_tickets ); |
|
1493 | + if ( ! empty($related_tickets)) { |
|
1494 | + $template_args['total_ticket_rows'] = count($related_tickets); |
|
1495 | 1495 | $row = 0; |
1496 | - foreach ( $related_tickets as $ticket ) { |
|
1497 | - $existing_ticket_ids[] = $ticket->get( 'TKT_ID' ); |
|
1498 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row ); |
|
1496 | + foreach ($related_tickets as $ticket) { |
|
1497 | + $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
|
1498 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row); |
|
1499 | 1499 | $row++; |
1500 | 1500 | } |
1501 | 1501 | } else { |
1502 | 1502 | $template_args['total_ticket_rows'] = 1; |
1503 | 1503 | /** @type EE_Ticket $ticket */ |
1504 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(); |
|
1505 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1504 | + $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
|
1505 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1506 | 1506 | } |
1507 | 1507 | } else { |
1508 | 1508 | $template_args['time'] = $times[0]; |
1509 | 1509 | /** @type EE_Ticket $ticket */ |
1510 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets(); |
|
1511 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1510 | + $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
1511 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1512 | 1512 | // NOTE: we're just sending the first default row |
1513 | 1513 | // (decaf can't manage default tickets so this should be sufficient); |
1514 | 1514 | } |
1515 | 1515 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link( |
1516 | 1516 | 'event_editor_event_datetimes_help_tab' |
1517 | 1517 | ); |
1518 | - $template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' ); |
|
1519 | - $template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
1520 | - $template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
1518 | + $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
|
1519 | + $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
1520 | + $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
1521 | 1521 | $template_args['ticket_js_structure'] = $this->_get_ticket_row( |
1522 | - EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(), |
|
1522 | + EE_Registry::instance()->load_model('Ticket')->create_default_object(), |
|
1523 | 1523 | true |
1524 | 1524 | ); |
1525 | 1525 | $template = apply_filters( |
1526 | 1526 | 'FHEE__Events_Admin_Page__ticket_metabox__template', |
1527 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' |
|
1527 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php' |
|
1528 | 1528 | ); |
1529 | - EEH_Template::display_template( $template, $template_args ); |
|
1529 | + EEH_Template::display_template($template, $template_args); |
|
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | |
@@ -1540,74 +1540,74 @@ discard block |
||
1540 | 1540 | * @param int $row |
1541 | 1541 | * @return string generated html for the ticket row. |
1542 | 1542 | */ |
1543 | - private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) { |
|
1543 | + private function _get_ticket_row($ticket, $skeleton = false, $row = 0) { |
|
1544 | 1544 | $template_args = array( |
1545 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1545 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1546 | 1546 | 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' |
1547 | 1547 | : '', |
1548 | 1548 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1549 | - 'TKT_ID' => $ticket->get( 'TKT_ID' ), |
|
1550 | - 'TKT_name' => $ticket->get( 'TKT_name' ), |
|
1551 | - 'TKT_start_date' => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ), |
|
1552 | - 'TKT_end_date' => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ), |
|
1553 | - 'TKT_is_default' => $ticket->get( 'TKT_is_default' ), |
|
1554 | - 'TKT_qty' => $ticket->get_pretty( 'TKT_qty', 'input' ), |
|
1549 | + 'TKT_ID' => $ticket->get('TKT_ID'), |
|
1550 | + 'TKT_name' => $ticket->get('TKT_name'), |
|
1551 | + 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
|
1552 | + 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
|
1553 | + 'TKT_is_default' => $ticket->get('TKT_is_default'), |
|
1554 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1555 | 1555 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1556 | - 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
|
1557 | - 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
|
1558 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1556 | + 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
|
1557 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) |
|
1558 | + && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) |
|
1559 | 1559 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1560 | - 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
|
1560 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' |
|
1561 | 1561 | : ' disabled=disabled', |
1562 | 1562 | ); |
1563 | 1563 | $price = $ticket->ID() !== 0 |
1564 | - ? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) ) |
|
1565 | - : EE_Registry::instance()->load_model( 'Price' )->create_default_object(); |
|
1564 | + ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) |
|
1565 | + : EE_Registry::instance()->load_model('Price')->create_default_object(); |
|
1566 | 1566 | $price_args = array( |
1567 | 1567 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1568 | - 'PRC_amount' => $price->get( 'PRC_amount' ), |
|
1569 | - 'PRT_ID' => $price->get( 'PRT_ID' ), |
|
1570 | - 'PRC_ID' => $price->get( 'PRC_ID' ), |
|
1571 | - 'PRC_is_default' => $price->get( 'PRC_is_default' ), |
|
1568 | + 'PRC_amount' => $price->get('PRC_amount'), |
|
1569 | + 'PRT_ID' => $price->get('PRT_ID'), |
|
1570 | + 'PRC_ID' => $price->get('PRC_ID'), |
|
1571 | + 'PRC_is_default' => $price->get('PRC_is_default'), |
|
1572 | 1572 | ); |
1573 | 1573 | //make sure we have default start and end dates if skeleton |
1574 | 1574 | //handle rows that should NOT be empty |
1575 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1575 | + if (empty($template_args['TKT_start_date'])) { |
|
1576 | 1576 | //if empty then the start date will be now. |
1577 | - $template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) ); |
|
1577 | + $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
|
1578 | 1578 | } |
1579 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1579 | + if (empty($template_args['TKT_end_date'])) { |
|
1580 | 1580 | //get the earliest datetime (if present); |
1581 | 1581 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 |
1582 | 1582 | ? $this->_cpt_model_obj->get_first_related( |
1583 | 1583 | 'Datetime', |
1584 | - array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) |
|
1584 | + array('order_by' => array('DTT_EVT_start' => 'ASC')) |
|
1585 | 1585 | ) |
1586 | 1586 | : null; |
1587 | - if ( ! empty( $earliest_dtt ) ) { |
|
1588 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' ); |
|
1587 | + if ( ! empty($earliest_dtt)) { |
|
1588 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1589 | 1589 | } else { |
1590 | 1590 | $template_args['TKT_end_date'] = date( |
1591 | 1591 | 'Y-m-d h:i a', |
1592 | - mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) ) |
|
1592 | + mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")) |
|
1593 | 1593 | ); |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | - $template_args = array_merge( $template_args, $price_args ); |
|
1596 | + $template_args = array_merge($template_args, $price_args); |
|
1597 | 1597 | $template = apply_filters( |
1598 | 1598 | 'FHEE__Events_Admin_Page__get_ticket_row__template', |
1599 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', |
|
1599 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', |
|
1600 | 1600 | $ticket |
1601 | 1601 | ); |
1602 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
1602 | + return EEH_Template::display_template($template, $template_args, true); |
|
1603 | 1603 | } |
1604 | 1604 | |
1605 | 1605 | |
1606 | 1606 | |
1607 | 1607 | public function registration_options_meta_box() { |
1608 | 1608 | $yes_no_values = array( |
1609 | - array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ), |
|
1610 | - array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ), |
|
1609 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
1610 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
1611 | 1611 | ); |
1612 | 1612 | $default_reg_status_values = EEM_Registration::reg_status_array( |
1613 | 1613 | array( |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | ); |
1620 | 1620 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1621 | 1621 | $template_args['_event'] = $this->_cpt_model_obj; |
1622 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false ); |
|
1622 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1623 | 1623 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
1624 | 1624 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
1625 | 1625 | 'default_reg_status', |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | $default_reg_status_values |
1648 | 1648 | ); |
1649 | 1649 | EEH_Template::display_template( |
1650 | - EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1650 | + EVENTS_TEMPLATE_PATH.'event_registration_options.template.php', |
|
1651 | 1651 | $template_args |
1652 | 1652 | ); |
1653 | 1653 | } |
@@ -1666,97 +1666,97 @@ discard block |
||
1666 | 1666 | * that match the given _view and paging parameters. |
1667 | 1667 | * @return array an array of event objects. |
1668 | 1668 | */ |
1669 | - public function get_events( $per_page = 10, $current_page = 1, $count = false ) { |
|
1669 | + public function get_events($per_page = 10, $current_page = 1, $count = false) { |
|
1670 | 1670 | $EEME = $this->_event_model(); |
1671 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1672 | - $limit = $count ? null : $offset . ',' . $per_page; |
|
1673 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1674 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC"; |
|
1675 | - if ( isset( $this->_req_data['month_range'] ) ) { |
|
1676 | - $pieces = explode( ' ', $this->_req_data['month_range'], 3 ); |
|
1677 | - $month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : ''; |
|
1678 | - $year_r = ! empty( $pieces[1] ) ? $pieces[1] : ''; |
|
1671 | + $offset = ($current_page - 1) * $per_page; |
|
1672 | + $limit = $count ? null : $offset.','.$per_page; |
|
1673 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1674 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
|
1675 | + if (isset($this->_req_data['month_range'])) { |
|
1676 | + $pieces = explode(' ', $this->_req_data['month_range'], 3); |
|
1677 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1678 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1679 | 1679 | } |
1680 | 1680 | $where = array(); |
1681 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
1681 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1682 | 1682 | //determine what post_status our condition will have for the query. |
1683 | - switch ( $status ) { |
|
1683 | + switch ($status) { |
|
1684 | 1684 | case 'month' : |
1685 | 1685 | case 'today' : |
1686 | 1686 | case null : |
1687 | 1687 | case 'all' : |
1688 | 1688 | break; |
1689 | 1689 | case 'draft' : |
1690 | - $where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) ); |
|
1690 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1691 | 1691 | break; |
1692 | 1692 | default : |
1693 | 1693 | $where['status'] = $status; |
1694 | 1694 | } |
1695 | 1695 | //categories? |
1696 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 |
|
1696 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1697 | 1697 | ? $this->_req_data['EVT_CAT'] : null; |
1698 | - if ( ! empty ( $category ) ) { |
|
1698 | + if ( ! empty ($category)) { |
|
1699 | 1699 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1700 | 1700 | $where['Term_Taxonomy.term_id'] = $category; |
1701 | 1701 | } |
1702 | 1702 | //date where conditions |
1703 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1704 | - if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) { |
|
1703 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1704 | + if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
|
1705 | 1705 | $DateTime = new DateTime( |
1706 | - $year_r . '-' . $month_r . '-01 00:00:00', |
|
1707 | - new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) |
|
1706 | + $year_r.'-'.$month_r.'-01 00:00:00', |
|
1707 | + new DateTimeZone(EEM_Datetime::instance()->get_timezone()) |
|
1708 | 1708 | ); |
1709 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1710 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format( |
|
1711 | - implode( ' ', $start_formats ) |
|
1709 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1710 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format( |
|
1711 | + implode(' ', $start_formats) |
|
1712 | 1712 | ); |
1713 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1714 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) { |
|
1715 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1716 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1717 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1718 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1719 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) { |
|
1720 | - $now = date( 'Y-m-01' ); |
|
1721 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1722 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1723 | - $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
|
1724 | - ->setTime( 23, 59, 59 ) |
|
1725 | - ->format( implode( ' ', $start_formats ) ); |
|
1726 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1713 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1714 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
|
1715 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1716 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1717 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1718 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1719 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1720 | + $now = date('Y-m-01'); |
|
1721 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1722 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1723 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t')) |
|
1724 | + ->setTime(23, 59, 59) |
|
1725 | + ->format(implode(' ', $start_formats)); |
|
1726 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1727 | 1727 | } |
1728 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1728 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1729 | 1729 | $where['EVT_wp_user'] = get_current_user_id(); |
1730 | 1730 | } else { |
1731 | - if ( ! isset( $where['status'] ) ) { |
|
1732 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1731 | + if ( ! isset($where['status'])) { |
|
1732 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1733 | 1733 | $where['OR'] = array( |
1734 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1734 | + 'status*restrict_private' => array('!=', 'private'), |
|
1735 | 1735 | 'AND' => array( |
1736 | - 'status*inclusive' => array( '=', 'private' ), |
|
1736 | + 'status*inclusive' => array('=', 'private'), |
|
1737 | 1737 | 'EVT_wp_user' => get_current_user_id(), |
1738 | 1738 | ), |
1739 | 1739 | ); |
1740 | 1740 | } |
1741 | 1741 | } |
1742 | 1742 | } |
1743 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1744 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1745 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1743 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1744 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1745 | + && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events') |
|
1746 | 1746 | ) { |
1747 | 1747 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1748 | 1748 | } |
1749 | 1749 | } |
1750 | 1750 | //search query handling |
1751 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1752 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1751 | + if (isset($this->_req_data['s'])) { |
|
1752 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1753 | 1753 | $where['OR'] = array( |
1754 | - 'EVT_name' => array( 'LIKE', $search_string ), |
|
1755 | - 'EVT_desc' => array( 'LIKE', $search_string ), |
|
1756 | - 'EVT_short_desc' => array( 'LIKE', $search_string ), |
|
1754 | + 'EVT_name' => array('LIKE', $search_string), |
|
1755 | + 'EVT_desc' => array('LIKE', $search_string), |
|
1756 | + 'EVT_short_desc' => array('LIKE', $search_string), |
|
1757 | 1757 | ); |
1758 | 1758 | } |
1759 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1759 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1760 | 1760 | $query_params = apply_filters( |
1761 | 1761 | 'FHEE__Events_Admin_Page__get_events__query_params', |
1762 | 1762 | array( |
@@ -1769,23 +1769,23 @@ discard block |
||
1769 | 1769 | $this->_req_data |
1770 | 1770 | ); |
1771 | 1771 | //let's first check if we have special requests coming in. |
1772 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1773 | - switch ( $this->_req_data['active_status'] ) { |
|
1772 | + if (isset($this->_req_data['active_status'])) { |
|
1773 | + switch ($this->_req_data['active_status']) { |
|
1774 | 1774 | case 'upcoming' : |
1775 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1775 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1776 | 1776 | break; |
1777 | 1777 | case 'expired' : |
1778 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1778 | + return $EEME->get_expired_events($query_params, $count); |
|
1779 | 1779 | break; |
1780 | 1780 | case 'active' : |
1781 | - return $EEME->get_active_events( $query_params, $count ); |
|
1781 | + return $EEME->get_active_events($query_params, $count); |
|
1782 | 1782 | break; |
1783 | 1783 | case 'inactive' : |
1784 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1784 | + return $EEME->get_inactive_events($query_params, $count); |
|
1785 | 1785 | break; |
1786 | 1786 | } |
1787 | 1787 | } |
1788 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1788 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1789 | 1789 | return $events; |
1790 | 1790 | } |
1791 | 1791 | |
@@ -1796,9 +1796,9 @@ discard block |
||
1796 | 1796 | * |
1797 | 1797 | * @param string $post_id |
1798 | 1798 | */ |
1799 | - public function trash_cpt_item( $post_id ) { |
|
1799 | + public function trash_cpt_item($post_id) { |
|
1800 | 1800 | $this->_req_data['EVT_ID'] = $post_id; |
1801 | - $this->_trash_or_restore_event( 'trash', false ); |
|
1801 | + $this->_trash_or_restore_event('trash', false); |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | |
@@ -1806,9 +1806,9 @@ discard block |
||
1806 | 1806 | /** |
1807 | 1807 | * @param string $post_id |
1808 | 1808 | */ |
1809 | - public function restore_cpt_item( $post_id ) { |
|
1809 | + public function restore_cpt_item($post_id) { |
|
1810 | 1810 | $this->_req_data['EVT_ID'] = $post_id; |
1811 | - $this->_trash_or_restore_event( 'draft', false ); |
|
1811 | + $this->_trash_or_restore_event('draft', false); |
|
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | |
@@ -1816,9 +1816,9 @@ discard block |
||
1816 | 1816 | /** |
1817 | 1817 | * @param string $post_id |
1818 | 1818 | */ |
1819 | - public function delete_cpt_item( $post_id ) { |
|
1819 | + public function delete_cpt_item($post_id) { |
|
1820 | 1820 | $this->_req_data['EVT_ID'] = $post_id; |
1821 | - $this->_delete_event( false ); |
|
1821 | + $this->_delete_event(false); |
|
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | |
@@ -1830,23 +1830,23 @@ discard block |
||
1830 | 1830 | * @param string $event_status |
1831 | 1831 | * @param bool $redirect_after |
1832 | 1832 | */ |
1833 | - protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) { |
|
1833 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) { |
|
1834 | 1834 | //determine the event id and set to array. |
1835 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false; |
|
1835 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false; |
|
1836 | 1836 | // loop thru events |
1837 | - if ( $EVT_ID ) { |
|
1837 | + if ($EVT_ID) { |
|
1838 | 1838 | // clean status |
1839 | - $event_status = sanitize_key( $event_status ); |
|
1839 | + $event_status = sanitize_key($event_status); |
|
1840 | 1840 | // grab status |
1841 | - if ( ! empty( $event_status ) ) { |
|
1842 | - $success = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1841 | + if ( ! empty($event_status)) { |
|
1842 | + $success = $this->_change_event_status($EVT_ID, $event_status); |
|
1843 | 1843 | } else { |
1844 | 1844 | $success = false; |
1845 | 1845 | $msg = esc_html__( |
1846 | 1846 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1847 | 1847 | 'event_espresso' |
1848 | 1848 | ); |
1849 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1849 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1850 | 1850 | } |
1851 | 1851 | } else { |
1852 | 1852 | $success = false; |
@@ -1854,11 +1854,11 @@ discard block |
||
1854 | 1854 | 'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', |
1855 | 1855 | 'event_espresso' |
1856 | 1856 | ); |
1857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1858 | 1858 | } |
1859 | 1859 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1860 | - if ( $redirect_after ) { |
|
1861 | - $this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) ); |
|
1860 | + if ($redirect_after) { |
|
1861 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1862 | 1862 | } |
1863 | 1863 | } |
1864 | 1864 | |
@@ -1871,18 +1871,18 @@ discard block |
||
1871 | 1871 | * @param string $event_status |
1872 | 1872 | * @return void |
1873 | 1873 | */ |
1874 | - protected function _trash_or_restore_events( $event_status = 'trash' ) { |
|
1874 | + protected function _trash_or_restore_events($event_status = 'trash') { |
|
1875 | 1875 | // clean status |
1876 | - $event_status = sanitize_key( $event_status ); |
|
1876 | + $event_status = sanitize_key($event_status); |
|
1877 | 1877 | // grab status |
1878 | - if ( ! empty( $event_status ) ) { |
|
1878 | + if ( ! empty($event_status)) { |
|
1879 | 1879 | $success = true; |
1880 | 1880 | //determine the event id and set to array. |
1881 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1881 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1882 | 1882 | // loop thru events |
1883 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
1884 | - if ( $EVT_ID = absint( $EVT_ID ) ) { |
|
1885 | - $results = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1883 | + foreach ($EVT_IDs as $EVT_ID) { |
|
1884 | + if ($EVT_ID = absint($EVT_ID)) { |
|
1885 | + $results = $this->_change_event_status($EVT_ID, $event_status); |
|
1886 | 1886 | $success = $results !== false ? $success : false; |
1887 | 1887 | } else { |
1888 | 1888 | $msg = sprintf( |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | ), |
1893 | 1893 | $EVT_ID |
1894 | 1894 | ); |
1895 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1895 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1896 | 1896 | $success = false; |
1897 | 1897 | } |
1898 | 1898 | } |
@@ -1902,12 +1902,12 @@ discard block |
||
1902 | 1902 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1903 | 1903 | 'event_espresso' |
1904 | 1904 | ); |
1905 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1905 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1906 | 1906 | } |
1907 | 1907 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
1908 | 1908 | $success = $success ? 2 : false; |
1909 | 1909 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1910 | - $this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) ); |
|
1910 | + $this->_redirect_after_action($success, 'Events', $action, array('action' => 'default')); |
|
1911 | 1911 | } |
1912 | 1912 | |
1913 | 1913 | |
@@ -1920,30 +1920,30 @@ discard block |
||
1920 | 1920 | * @param string $event_status |
1921 | 1921 | * @return bool |
1922 | 1922 | */ |
1923 | - private function _change_event_status( $EVT_ID = 0, $event_status = '' ) { |
|
1923 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1924 | 1924 | // grab event id |
1925 | - if ( ! $EVT_ID ) { |
|
1925 | + if ( ! $EVT_ID) { |
|
1926 | 1926 | $msg = esc_html__( |
1927 | 1927 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
1928 | 1928 | 'event_espresso' |
1929 | 1929 | ); |
1930 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1930 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1931 | 1931 | return false; |
1932 | 1932 | } |
1933 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1933 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1934 | 1934 | // clean status |
1935 | - $event_status = sanitize_key( $event_status ); |
|
1935 | + $event_status = sanitize_key($event_status); |
|
1936 | 1936 | // grab status |
1937 | - if ( empty( $event_status ) ) { |
|
1937 | + if (empty($event_status)) { |
|
1938 | 1938 | $msg = esc_html__( |
1939 | 1939 | 'An error occurred. No Event Status or an invalid Event Status was received.', |
1940 | 1940 | 'event_espresso' |
1941 | 1941 | ); |
1942 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1942 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1943 | 1943 | return false; |
1944 | 1944 | } |
1945 | 1945 | // was event trashed or restored ? |
1946 | - switch ( $event_status ) { |
|
1946 | + switch ($event_status) { |
|
1947 | 1947 | case 'draft' : |
1948 | 1948 | $action = 'restored from the trash'; |
1949 | 1949 | $hook = 'AHEE_event_restored_from_trash'; |
@@ -1957,15 +1957,15 @@ discard block |
||
1957 | 1957 | $hook = false; |
1958 | 1958 | } |
1959 | 1959 | //use class to change status |
1960 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1960 | + $this->_cpt_model_obj->set_status($event_status); |
|
1961 | 1961 | $success = $this->_cpt_model_obj->save(); |
1962 | - if ( $success === false ) { |
|
1963 | - $msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action ); |
|
1964 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1962 | + if ($success === false) { |
|
1963 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1964 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1965 | 1965 | return false; |
1966 | 1966 | } |
1967 | - if ( $hook ) { |
|
1968 | - do_action( $hook ); |
|
1967 | + if ($hook) { |
|
1968 | + do_action($hook); |
|
1969 | 1969 | } |
1970 | 1970 | return true; |
1971 | 1971 | } |
@@ -1978,34 +1978,34 @@ discard block |
||
1978 | 1978 | * @access protected |
1979 | 1979 | * @param bool $redirect_after |
1980 | 1980 | */ |
1981 | - protected function _delete_event( $redirect_after = true ) { |
|
1981 | + protected function _delete_event($redirect_after = true) { |
|
1982 | 1982 | //determine the event id and set to array. |
1983 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null; |
|
1984 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1983 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null; |
|
1984 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1985 | 1985 | // loop thru events |
1986 | - if ( $EVT_ID ) { |
|
1987 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1986 | + if ($EVT_ID) { |
|
1987 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1988 | 1988 | // get list of events with no prices |
1989 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1989 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1990 | 1990 | // remove this event from the list of events with no prices |
1991 | - if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) { |
|
1992 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1991 | + if (isset($espresso_no_ticket_prices[$EVT_ID])) { |
|
1992 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1993 | 1993 | } |
1994 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
1994 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
1995 | 1995 | } else { |
1996 | 1996 | $success = false; |
1997 | 1997 | $msg = esc_html__( |
1998 | 1998 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
1999 | 1999 | 'event_espresso' |
2000 | 2000 | ); |
2001 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2001 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2002 | 2002 | } |
2003 | - if ( $redirect_after ) { |
|
2003 | + if ($redirect_after) { |
|
2004 | 2004 | $this->_redirect_after_action( |
2005 | 2005 | $success, |
2006 | 2006 | 'Event', |
2007 | 2007 | 'deleted', |
2008 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
2008 | + array('action' => 'default', 'status' => 'trash') |
|
2009 | 2009 | ); |
2010 | 2010 | } |
2011 | 2011 | } |
@@ -2021,30 +2021,30 @@ discard block |
||
2021 | 2021 | protected function _delete_events() { |
2022 | 2022 | $success = true; |
2023 | 2023 | // get list of events with no prices |
2024 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
2024 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
2025 | 2025 | //determine the event id and set to array. |
2026 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2026 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2027 | 2027 | // loop thru events |
2028 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
2029 | - $EVT_ID = absint( $EVT_ID ); |
|
2030 | - if ( $EVT_ID ) { |
|
2031 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
2028 | + foreach ($EVT_IDs as $EVT_ID) { |
|
2029 | + $EVT_ID = absint($EVT_ID); |
|
2030 | + if ($EVT_ID) { |
|
2031 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
2032 | 2032 | $success = $results !== false ? $success : false; |
2033 | 2033 | // remove this event from the list of events with no prices |
2034 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
2034 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
2035 | 2035 | } else { |
2036 | 2036 | $success = false; |
2037 | 2037 | $msg = esc_html__( |
2038 | 2038 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
2039 | 2039 | 'event_espresso' |
2040 | 2040 | ); |
2041 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2041 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2042 | 2042 | } |
2043 | 2043 | } |
2044 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
2044 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
2045 | 2045 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
2046 | 2046 | $success = $success ? 2 : false; |
2047 | - $this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) ); |
|
2047 | + $this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default')); |
|
2048 | 2048 | } |
2049 | 2049 | |
2050 | 2050 | |
@@ -2056,70 +2056,70 @@ discard block |
||
2056 | 2056 | * @param int $EVT_ID |
2057 | 2057 | * @return bool |
2058 | 2058 | */ |
2059 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
2059 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
2060 | 2060 | // grab event id |
2061 | - if ( ! $EVT_ID ) { |
|
2061 | + if ( ! $EVT_ID) { |
|
2062 | 2062 | $msg = esc_html__( |
2063 | 2063 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
2064 | 2064 | 'event_espresso' |
2065 | 2065 | ); |
2066 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2066 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2067 | 2067 | return false; |
2068 | 2068 | } |
2069 | 2069 | if ( |
2070 | 2070 | ! $this->_cpt_model_obj instanceof EE_Event |
2071 | 2071 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
2072 | 2072 | ) { |
2073 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
2073 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
2074 | 2074 | } |
2075 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
2075 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
2076 | 2076 | return false; |
2077 | 2077 | } |
2078 | 2078 | //need to delete related tickets and prices first. |
2079 | - $datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' ); |
|
2080 | - foreach ( $datetimes as $datetime ) { |
|
2081 | - $this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' ); |
|
2082 | - $tickets = $datetime->get_many_related( 'Ticket' ); |
|
2083 | - foreach ( $tickets as $ticket ) { |
|
2084 | - $ticket->_remove_relation_to( $datetime, 'Datetime' ); |
|
2085 | - $ticket->delete_related_permanently( 'Price' ); |
|
2079 | + $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
|
2080 | + foreach ($datetimes as $datetime) { |
|
2081 | + $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
|
2082 | + $tickets = $datetime->get_many_related('Ticket'); |
|
2083 | + foreach ($tickets as $ticket) { |
|
2084 | + $ticket->_remove_relation_to($datetime, 'Datetime'); |
|
2085 | + $ticket->delete_related_permanently('Price'); |
|
2086 | 2086 | $ticket->delete_permanently(); |
2087 | 2087 | } |
2088 | 2088 | $datetime->delete(); |
2089 | 2089 | } |
2090 | 2090 | //what about related venues or terms? |
2091 | - $venues = $this->_cpt_model_obj->get_many_related( 'Venue' ); |
|
2092 | - foreach ( $venues as $venue ) { |
|
2093 | - $this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' ); |
|
2091 | + $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
|
2092 | + foreach ($venues as $venue) { |
|
2093 | + $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
|
2094 | 2094 | } |
2095 | 2095 | //any attached question groups? |
2096 | - $question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' ); |
|
2097 | - if ( ! empty( $question_groups ) ) { |
|
2098 | - foreach ( $question_groups as $question_group ) { |
|
2099 | - $this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' ); |
|
2096 | + $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
|
2097 | + if ( ! empty($question_groups)) { |
|
2098 | + foreach ($question_groups as $question_group) { |
|
2099 | + $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
|
2100 | 2100 | } |
2101 | 2101 | } |
2102 | 2102 | //Message Template Groups |
2103 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
2103 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
2104 | 2104 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
2105 | 2105 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
2106 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
2107 | - $this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy ); |
|
2106 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
2107 | + $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
|
2108 | 2108 | } |
2109 | 2109 | $success = $this->_cpt_model_obj->delete_permanently(); |
2110 | 2110 | // did it all go as planned ? |
2111 | - if ( $success ) { |
|
2112 | - $msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID ); |
|
2113 | - EE_Error::add_success( $msg ); |
|
2111 | + if ($success) { |
|
2112 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
2113 | + EE_Error::add_success($msg); |
|
2114 | 2114 | } else { |
2115 | 2115 | $msg = sprintf( |
2116 | - esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ), |
|
2116 | + esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), |
|
2117 | 2117 | $EVT_ID |
2118 | 2118 | ); |
2119 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2119 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2120 | 2120 | return false; |
2121 | 2121 | } |
2122 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2122 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2123 | 2123 | return true; |
2124 | 2124 | } |
2125 | 2125 | |
@@ -2132,7 +2132,7 @@ discard block |
||
2132 | 2132 | * @return int |
2133 | 2133 | */ |
2134 | 2134 | public function total_events() { |
2135 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2135 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2136 | 2136 | return $count; |
2137 | 2137 | } |
2138 | 2138 | |
@@ -2146,9 +2146,9 @@ discard block |
||
2146 | 2146 | */ |
2147 | 2147 | public function total_events_draft() { |
2148 | 2148 | $where = array( |
2149 | - 'status' => array( 'IN', array( 'draft', 'auto-draft' ) ), |
|
2149 | + 'status' => array('IN', array('draft', 'auto-draft')), |
|
2150 | 2150 | ); |
2151 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2151 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2152 | 2152 | return $count; |
2153 | 2153 | } |
2154 | 2154 | |
@@ -2164,7 +2164,7 @@ discard block |
||
2164 | 2164 | $where = array( |
2165 | 2165 | 'status' => 'trash', |
2166 | 2166 | ); |
2167 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2167 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2168 | 2168 | return $count; |
2169 | 2169 | } |
2170 | 2170 | |
@@ -2195,12 +2195,12 @@ discard block |
||
2195 | 2195 | EE_Registry::instance()->CFG->registration->default_STS_ID, |
2196 | 2196 | $this->_template_args['reg_status_array'] |
2197 | 2197 | ) |
2198 | - ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) |
|
2198 | + ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) |
|
2199 | 2199 | : EEM_Registration::status_id_pending_payment; |
2200 | - $this->_set_add_edit_form_tags( 'update_default_event_settings' ); |
|
2201 | - $this->_set_publish_post_box_vars( null, false, false, null, false ); |
|
2200 | + $this->_set_add_edit_form_tags('update_default_event_settings'); |
|
2201 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
2202 | 2202 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2203 | - EVENTS_TEMPLATE_PATH . 'event_settings.template.php', |
|
2203 | + EVENTS_TEMPLATE_PATH.'event_settings.template.php', |
|
2204 | 2204 | $this->_template_args, |
2205 | 2205 | true |
2206 | 2206 | ); |
@@ -2216,8 +2216,8 @@ discard block |
||
2216 | 2216 | * @return void |
2217 | 2217 | */ |
2218 | 2218 | protected function _update_default_event_settings() { |
2219 | - EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] ) |
|
2220 | - ? sanitize_text_field( $this->_req_data['default_reg_status'] ) |
|
2219 | + EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status']) |
|
2220 | + ? sanitize_text_field($this->_req_data['default_reg_status']) |
|
2221 | 2221 | : EEM_Registration::status_id_pending_payment; |
2222 | 2222 | $what = 'Default Event Settings'; |
2223 | 2223 | $success = $this->_update_espresso_configuration( |
@@ -2227,7 +2227,7 @@ discard block |
||
2227 | 2227 | __FUNCTION__, |
2228 | 2228 | __LINE__ |
2229 | 2229 | ); |
2230 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) ); |
|
2230 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings')); |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | |
@@ -2237,20 +2237,20 @@ discard block |
||
2237 | 2237 | |
2238 | 2238 | |
2239 | 2239 | protected function _template_settings() { |
2240 | - $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
|
2240 | + $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
|
2241 | 2241 | $this->_template_args['preview_img'] = '<img src="' |
2242 | 2242 | . EVENTS_ASSETS_URL |
2243 | 2243 | . DS |
2244 | 2244 | . 'images' |
2245 | 2245 | . DS |
2246 | 2246 | . 'caffeinated_template_features.jpg" alt="' |
2247 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2247 | + . esc_attr__('Template Settings Preview screenshot', 'event_espresso') |
|
2248 | 2248 | . '" />'; |
2249 | - $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
|
2249 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__( |
|
2250 | 2250 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2251 | 2251 | 'event_espresso' |
2252 | - ) . '</strong>'; |
|
2253 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2252 | + ).'</strong>'; |
|
2253 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2254 | 2254 | } |
2255 | 2255 | |
2256 | 2256 | |
@@ -2262,18 +2262,18 @@ discard block |
||
2262 | 2262 | * @return void |
2263 | 2263 | */ |
2264 | 2264 | private function _set_category_object() { |
2265 | - if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) { |
|
2265 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
2266 | 2266 | return; |
2267 | 2267 | } //already have the category object so get out. |
2268 | 2268 | //set default category object |
2269 | 2269 | $this->_set_empty_category_object(); |
2270 | 2270 | //only set if we've got an id |
2271 | - if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) { |
|
2271 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2272 | 2272 | return; |
2273 | 2273 | } |
2274 | - $category_id = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
2275 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2276 | - if ( ! empty( $term ) ) { |
|
2274 | + $category_id = absint($this->_req_data['EVT_CAT_ID']); |
|
2275 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2276 | + if ( ! empty($term)) { |
|
2277 | 2277 | $this->_category->category_name = $term->name; |
2278 | 2278 | $this->_category->category_identifier = $term->slug; |
2279 | 2279 | $this->_category->category_desc = $term->description; |
@@ -2293,9 +2293,9 @@ discard block |
||
2293 | 2293 | |
2294 | 2294 | |
2295 | 2295 | protected function _category_list_table() { |
2296 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2297 | - $this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' ); |
|
2298 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
2296 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2297 | + $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
|
2298 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
2299 | 2299 | 'add_category', |
2300 | 2300 | 'add_category', |
2301 | 2301 | array(), |
@@ -2309,20 +2309,20 @@ discard block |
||
2309 | 2309 | /** |
2310 | 2310 | * @param $view |
2311 | 2311 | */ |
2312 | - protected function _category_details( $view ) { |
|
2312 | + protected function _category_details($view) { |
|
2313 | 2313 | //load formatter helper |
2314 | 2314 | //load field generator helper |
2315 | 2315 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2316 | - $this->_set_add_edit_form_tags( $route ); |
|
2316 | + $this->_set_add_edit_form_tags($route); |
|
2317 | 2317 | $this->_set_category_object(); |
2318 | - $id = ! empty( $this->_category->id ) ? $this->_category->id : ''; |
|
2318 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2319 | 2319 | $delete_action = 'delete_category'; |
2320 | 2320 | //custom redirect |
2321 | 2321 | $redirect = EE_Admin_Page::add_query_args_and_nonce( |
2322 | - array( 'action' => 'category_list' ), |
|
2322 | + array('action' => 'category_list'), |
|
2323 | 2323 | $this->_admin_base_url |
2324 | 2324 | ); |
2325 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2325 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2326 | 2326 | //take care of contents |
2327 | 2327 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
2328 | 2328 | $this->display_admin_page_with_sidebar(); |
@@ -2336,21 +2336,21 @@ discard block |
||
2336 | 2336 | protected function _category_details_content() { |
2337 | 2337 | $editor_args['category_desc'] = array( |
2338 | 2338 | 'type' => 'wp_editor', |
2339 | - 'value' => EEH_Formatter::admin_format_content( $this->_category->category_desc ), |
|
2339 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
2340 | 2340 | 'class' => 'my_editor_custom', |
2341 | - 'wpeditor_args' => array( 'media_buttons' => false ), |
|
2341 | + 'wpeditor_args' => array('media_buttons' => false), |
|
2342 | 2342 | ); |
2343 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2343 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2344 | 2344 | $all_terms = get_terms( |
2345 | - array( 'espresso_event_categories' ), |
|
2346 | - array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) |
|
2345 | + array('espresso_event_categories'), |
|
2346 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
2347 | 2347 | ); |
2348 | 2348 | //setup category select for term parents. |
2349 | 2349 | $category_select_values[] = array( |
2350 | - 'text' => esc_html__( 'No Parent', 'event_espresso' ), |
|
2350 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
2351 | 2351 | 'id' => 0, |
2352 | 2352 | ); |
2353 | - foreach ( $all_terms as $term ) { |
|
2353 | + foreach ($all_terms as $term) { |
|
2354 | 2354 | $category_select_values[] = array( |
2355 | 2355 | 'text' => $term->name, |
2356 | 2356 | 'id' => $term->term_id, |
@@ -2364,28 +2364,28 @@ discard block |
||
2364 | 2364 | $template_args = array( |
2365 | 2365 | 'category' => $this->_category, |
2366 | 2366 | 'category_select' => $category_select, |
2367 | - 'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ), |
|
2367 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
2368 | 2368 | 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
2369 | 2369 | 'disable' => '', |
2370 | 2370 | 'disabled_message' => false, |
2371 | 2371 | ); |
2372 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2373 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
2372 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2373 | + return EEH_Template::display_template($template, $template_args, true); |
|
2374 | 2374 | } |
2375 | 2375 | |
2376 | 2376 | |
2377 | 2377 | |
2378 | 2378 | protected function _delete_categories() { |
2379 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2379 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2380 | 2380 | : (array) $this->_req_data['category_id']; |
2381 | - foreach ( $cat_ids as $cat_id ) { |
|
2382 | - $this->_delete_category( $cat_id ); |
|
2381 | + foreach ($cat_ids as $cat_id) { |
|
2382 | + $this->_delete_category($cat_id); |
|
2383 | 2383 | } |
2384 | 2384 | //doesn't matter what page we're coming from... we're going to the same place after delete. |
2385 | 2385 | $query_args = array( |
2386 | 2386 | 'action' => 'category_list', |
2387 | 2387 | ); |
2388 | - $this->_redirect_after_action( 0, '', '', $query_args ); |
|
2388 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | |
@@ -2393,9 +2393,9 @@ discard block |
||
2393 | 2393 | /** |
2394 | 2394 | * @param $cat_id |
2395 | 2395 | */ |
2396 | - protected function _delete_category( $cat_id ) { |
|
2397 | - $cat_id = absint( $cat_id ); |
|
2398 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2396 | + protected function _delete_category($cat_id) { |
|
2397 | + $cat_id = absint($cat_id); |
|
2398 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2399 | 2399 | } |
2400 | 2400 | |
2401 | 2401 | |
@@ -2403,18 +2403,18 @@ discard block |
||
2403 | 2403 | /** |
2404 | 2404 | * @param $new_category |
2405 | 2405 | */ |
2406 | - protected function _insert_or_update_category( $new_category ) { |
|
2407 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true ); |
|
2406 | + protected function _insert_or_update_category($new_category) { |
|
2407 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
2408 | 2408 | $success = 0; //we already have a success message so lets not send another. |
2409 | - if ( $cat_id ) { |
|
2409 | + if ($cat_id) { |
|
2410 | 2410 | $query_args = array( |
2411 | 2411 | 'action' => 'edit_category', |
2412 | 2412 | 'EVT_CAT_ID' => $cat_id, |
2413 | 2413 | ); |
2414 | 2414 | } else { |
2415 | - $query_args = array( 'action' => 'add_category' ); |
|
2415 | + $query_args = array('action' => 'add_category'); |
|
2416 | 2416 | } |
2417 | - $this->_redirect_after_action( $success, '', '', $query_args, true ); |
|
2417 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
2418 | 2418 | } |
2419 | 2419 | |
2420 | 2420 | |
@@ -2423,14 +2423,14 @@ discard block |
||
2423 | 2423 | * @param bool $update |
2424 | 2424 | * @return bool|mixed|string |
2425 | 2425 | */ |
2426 | - private function _insert_category( $update = false ) { |
|
2426 | + private function _insert_category($update = false) { |
|
2427 | 2427 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2428 | - $category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2429 | - $category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2430 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2431 | - if ( empty( $category_name ) ) { |
|
2432 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2433 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2428 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2429 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2430 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2431 | + if (empty($category_name)) { |
|
2432 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2433 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2434 | 2434 | return false; |
2435 | 2435 | } |
2436 | 2436 | $term_args = array( |
@@ -2439,22 +2439,22 @@ discard block |
||
2439 | 2439 | 'parent' => $category_parent, |
2440 | 2440 | ); |
2441 | 2441 | //was the category_identifier input disabled? |
2442 | - if ( isset( $this->_req_data['category_identifier'] ) ) { |
|
2442 | + if (isset($this->_req_data['category_identifier'])) { |
|
2443 | 2443 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2444 | 2444 | } |
2445 | 2445 | $insert_ids = $update |
2446 | - ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) |
|
2447 | - : wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2448 | - if ( ! is_array( $insert_ids ) ) { |
|
2446 | + ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) |
|
2447 | + : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2448 | + if ( ! is_array($insert_ids)) { |
|
2449 | 2449 | $msg = esc_html__( |
2450 | 2450 | 'An error occurred and the category has not been saved to the database.', |
2451 | 2451 | 'event_espresso' |
2452 | 2452 | ); |
2453 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2453 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2454 | 2454 | } else { |
2455 | 2455 | $cat_id = $insert_ids['term_id']; |
2456 | - $msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name ); |
|
2457 | - EE_Error::add_success( $msg ); |
|
2456 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2457 | + EE_Error::add_success($msg); |
|
2458 | 2458 | } |
2459 | 2459 | return $cat_id; |
2460 | 2460 | } |
@@ -2467,28 +2467,28 @@ discard block |
||
2467 | 2467 | * @param bool $count |
2468 | 2468 | * @return \EE_Base_Class[]|int |
2469 | 2469 | */ |
2470 | - public function get_categories( $per_page = 10, $current_page = 1, $count = false ) { |
|
2470 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) { |
|
2471 | 2471 | //testing term stuff |
2472 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2473 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2474 | - $limit = ( $current_page - 1 ) * $per_page; |
|
2475 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2476 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2477 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2472 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2473 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2474 | + $limit = ($current_page - 1) * $per_page; |
|
2475 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2476 | + if (isset($this->_req_data['s'])) { |
|
2477 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2478 | 2478 | $where['OR'] = array( |
2479 | - 'Term.name' => array( 'LIKE', $sstr ), |
|
2480 | - 'description' => array( 'LIKE', $sstr ), |
|
2479 | + 'Term.name' => array('LIKE', $sstr), |
|
2480 | + 'description' => array('LIKE', $sstr), |
|
2481 | 2481 | ); |
2482 | 2482 | } |
2483 | 2483 | $query_params = array( |
2484 | 2484 | $where, |
2485 | - 'order_by' => array( $orderby => $order ), |
|
2486 | - 'limit' => $limit . ',' . $per_page, |
|
2487 | - 'force_join' => array( 'Term' ), |
|
2485 | + 'order_by' => array($orderby => $order), |
|
2486 | + 'limit' => $limit.','.$per_page, |
|
2487 | + 'force_join' => array('Term'), |
|
2488 | 2488 | ); |
2489 | 2489 | $categories = $count |
2490 | - ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) |
|
2491 | - : EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2490 | + ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
2491 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2492 | 2492 | return $categories; |
2493 | 2493 | } |
2494 | 2494 |