@@ -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 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | class EventListIframeEmbedButton extends IframeEmbedButton |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * EventListIframeEmbedButton constructor. |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct( |
|
24 | - esc_html__( 'Event List', 'event_espresso' ), |
|
25 | - 'event_list' |
|
26 | - ); |
|
27 | - } |
|
18 | + /** |
|
19 | + * EventListIframeEmbedButton constructor. |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct( |
|
24 | + esc_html__( 'Event List', 'event_espresso' ), |
|
25 | + 'event_list' |
|
26 | + ); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | |
44 | 44 | |
45 | 45 | /** |
46 | - * Adds an iframe embed code button to the Event editor. |
|
47 | - * return string |
|
48 | - */ |
|
49 | - public function addEventListIframeEmbedButtonSection() |
|
50 | - { |
|
51 | - return $this->addIframeEmbedButtonsSection( |
|
52 | - array( 'event_list' => $this->embedButtonHtml() ) |
|
53 | - ); |
|
54 | - } |
|
46 | + * Adds an iframe embed code button to the Event editor. |
|
47 | + * return string |
|
48 | + */ |
|
49 | + public function addEventListIframeEmbedButtonSection() |
|
50 | + { |
|
51 | + return $this->addIframeEmbedButtonsSection( |
|
52 | + array( 'event_list' => $this->embedButtonHtml() ) |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | 57 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\iframe_display; |
3 | 3 | |
4 | -defined( 'ABSPATH' ) || exit; |
|
4 | +defined('ABSPATH') || exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function __construct() |
22 | 22 | { |
23 | 23 | parent::__construct( |
24 | - esc_html__( 'Event List', 'event_espresso' ), |
|
24 | + esc_html__('Event List', 'event_espresso'), |
|
25 | 25 | 'event_list' |
26 | 26 | ); |
27 | 27 | } |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | public function addEmbedButton() { |
32 | 32 | add_filter( |
33 | 33 | 'FHEE__Events_Admin_Page___events_overview_list_table__after_list_table__before_legend', |
34 | - array( $this, 'addEventListIframeEmbedButtonSection' ) |
|
34 | + array($this, 'addEventListIframeEmbedButtonSection') |
|
35 | 35 | ); |
36 | 36 | add_action( |
37 | 37 | 'admin_enqueue_scripts', |
38 | - array( $this, 'embedButtonAssets' ), |
|
38 | + array($this, 'embedButtonAssets'), |
|
39 | 39 | 10 |
40 | 40 | ); |
41 | 41 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function addEventListIframeEmbedButtonSection() |
50 | 50 | { |
51 | 51 | return $this->addIframeEmbedButtonsSection( |
52 | - array( 'event_list' => $this->embedButtonHtml() ) |
|
52 | + array('event_list' => $this->embedButtonHtml()) |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 |
@@ -16,279 +16,279 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @var string $iframe_name |
|
21 | - */ |
|
22 | - private $iframe_name; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var string $route_name |
|
26 | - */ |
|
27 | - private $route_name; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string $slug |
|
31 | - */ |
|
32 | - private $slug; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var boolean $append_filterable_content |
|
36 | - */ |
|
37 | - private $append_filterable_content; |
|
38 | - |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * IframeEmbedButton constructor. |
|
43 | - * |
|
44 | - * @param string $iframe_name i18n name for the iframe. This will be used in HTML |
|
45 | - * @param string $route_name the name of the registered route |
|
46 | - * @param string $slug URL slug used for the thing the iframe button is being embedded in. |
|
47 | - * will most likely be "event" since that's the only usage atm |
|
48 | - */ |
|
49 | - public function __construct( $iframe_name, $route_name, $slug = 'event' ) |
|
50 | - { |
|
51 | - $this->iframe_name = $iframe_name; |
|
52 | - $this->route_name = $route_name; |
|
53 | - $this->slug = $slug; |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * Adds an iframe embed code button to the Event editor. |
|
60 | - */ |
|
61 | - public function addEventEditorIframeEmbedButtonFilter() |
|
62 | - { |
|
63 | - // add button for iframe code to event editor. |
|
64 | - add_filter( |
|
65 | - 'get_sample_permalink_html', |
|
66 | - array( $this, 'appendIframeEmbedButtonToSamplePermalinkHtml' ), |
|
67 | - 10, |
|
68 | - 2 |
|
69 | - ); |
|
70 | - add_action( |
|
71 | - 'admin_enqueue_scripts', |
|
72 | - array( $this, 'embedButtonAssets' ), |
|
73 | - 10 |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @param $permalink_string |
|
81 | - * @param $id |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id ) |
|
85 | - { |
|
86 | - return $this->eventEditorIframeEmbedButton( |
|
87 | - $permalink_string, |
|
88 | - $id |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * iframe embed code button to the Event editor. |
|
96 | - * |
|
97 | - * @param string $permalink_string |
|
98 | - * @param int $id |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function eventEditorIframeEmbedButton( |
|
102 | - $permalink_string, |
|
103 | - $id |
|
104 | - ) { |
|
105 | - //make sure this is ONLY when editing and the event id has been set. |
|
106 | - if ( ! empty( $id ) ) { |
|
107 | - $post = get_post( $id ); |
|
108 | - //if NOT event then let's get out. |
|
109 | - if ( $post->post_type !== 'espresso_events' ) { |
|
110 | - return $permalink_string; |
|
111 | - } |
|
112 | - $permalink_string .= $this->embedButtonHtml( |
|
113 | - array( $this->slug => $id ), |
|
114 | - 'button-small' |
|
115 | - ); |
|
116 | - } |
|
117 | - return $permalink_string; |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * Adds an iframe embed code button via a WP do_action() as determined by the first parameter |
|
124 | - * |
|
125 | - * @param string $action name of the WP do_action() to hook into |
|
126 | - */ |
|
127 | - public function addActionIframeEmbedButton( $action ) |
|
128 | - { |
|
129 | - // add button for iframe code to event editor. |
|
130 | - add_action( |
|
131 | - $action, |
|
132 | - array( $this, 'addActionIframeEmbedButtonCallback' ), |
|
133 | - 10, 2 |
|
134 | - ); |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @return void |
|
141 | - */ |
|
142 | - public function addActionIframeEmbedButtonCallback() |
|
143 | - { |
|
144 | - echo $this->embedButtonHtml(); |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter |
|
151 | - * |
|
152 | - * @param string $filter name of the WP apply_filters() to hook into |
|
153 | - * @param bool $append if true, will add iframe embed button to end of content, |
|
154 | - * else if false, will add to the beginning of the content |
|
155 | - */ |
|
156 | - public function addFilterIframeEmbedButton( $filter, $append = true ) |
|
157 | - { |
|
158 | - $this->append_filterable_content = $append; |
|
159 | - // add button for iframe code to event editor. |
|
160 | - add_filter( |
|
161 | - $filter, |
|
162 | - array( $this, 'addFilterIframeEmbedButtonCallback' ), |
|
163 | - 10 |
|
164 | - ); |
|
165 | - } |
|
166 | - |
|
167 | - |
|
168 | - |
|
169 | - /** |
|
170 | - * @param array|string $filterable_content |
|
171 | - * @return array|string |
|
172 | - */ |
|
173 | - public function addFilterIframeEmbedButtonCallback( $filterable_content ) |
|
174 | - { |
|
175 | - $embedButtonHtml = $this->embedButtonHtml(); |
|
176 | - if ( is_array( $filterable_content ) ) { |
|
177 | - $filterable_content = $this->append_filterable_content |
|
178 | - ? $filterable_content + array( $this->route_name => $embedButtonHtml ) |
|
179 | - : array( $this->route_name => $embedButtonHtml ) + $filterable_content; |
|
180 | - } else { |
|
181 | - $filterable_content = $this->append_filterable_content |
|
182 | - ? $filterable_content . $embedButtonHtml |
|
183 | - : $embedButtonHtml . $filterable_content; |
|
184 | - } |
|
185 | - return $filterable_content; |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * iframe_embed_html |
|
192 | - * |
|
193 | - * @param array $query_args |
|
194 | - * @param string $button_class |
|
195 | - * @return string |
|
196 | - */ |
|
197 | - public function embedButtonHtml( $query_args = array(), $button_class = '' ) |
|
198 | - { |
|
199 | - // incoming args will replace the defaults listed here in the second array (union preserves first array) |
|
200 | - $query_args = (array)$query_args + array( $this->route_name => 'iframe' ); |
|
201 | - $query_args = (array)apply_filters( |
|
202 | - 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
|
203 | - $query_args |
|
204 | - ); |
|
205 | - // add this route to our localized vars |
|
206 | - $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] ) |
|
207 | - ? \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] |
|
208 | - : array(); |
|
209 | - $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
210 | - \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] = $iframe_module_routes; |
|
211 | - $iframe_embed_html = \EEH_HTML::link( |
|
212 | - '#', |
|
213 | - sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ), |
|
214 | - sprintf( |
|
215 | - esc_html__( |
|
216 | - 'click here to generate code for embedding %1$s iframe into another site.', |
|
217 | - 'event_espresso' |
|
218 | - ), |
|
219 | - \EEH_Inflector::add_indefinite_article( $this->iframe_name ) |
|
220 | - ), |
|
221 | - "{$this->route_name}-iframe-embed-trigger-js", |
|
222 | - 'iframe-embed-trigger-js button ' . $button_class, |
|
223 | - '', |
|
224 | - ' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"' |
|
225 | - ); |
|
226 | - $iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js', |
|
227 | - 'display:none;' ); |
|
228 | - $iframe_embed_html .= esc_html( |
|
229 | - \EEH_HTML::div( |
|
230 | - '<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>', |
|
231 | - '', |
|
232 | - '', |
|
233 | - 'width:100%; height: 500px;' |
|
234 | - ) |
|
235 | - ); |
|
236 | - $iframe_embed_html .= \EEH_HTML::divx(); |
|
237 | - return $iframe_embed_html; |
|
238 | - } |
|
239 | - |
|
240 | - |
|
241 | - |
|
242 | - /** |
|
243 | - * enqueue iframe button js |
|
244 | - */ |
|
245 | - public function embedButtonAssets() |
|
246 | - { |
|
247 | - \EE_Registry::$i18n_js_strings[ 'iframe_embed_title' ] = esc_html__( |
|
248 | - 'copy and paste the following into any other site\'s content to display this event:', |
|
249 | - 'event_espresso' |
|
250 | - ); |
|
251 | - \EE_Registry::$i18n_js_strings[ 'iframe_embed_close_msg' ] = esc_html__( |
|
252 | - 'click anywhere outside of this window to close it.', |
|
253 | - 'event_espresso' |
|
254 | - ); |
|
255 | - wp_register_script( |
|
256 | - 'iframe_embed_button', |
|
257 | - plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js', |
|
258 | - array( 'ee-dialog' ), |
|
259 | - EVENT_ESPRESSO_VERSION, |
|
260 | - true |
|
261 | - ); |
|
262 | - wp_enqueue_script( 'iframe_embed_button' ); |
|
263 | - } |
|
264 | - |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * generates embed button sections for admin pages |
|
269 | - * |
|
270 | - * @param array $embed_buttons |
|
271 | - * @return string |
|
272 | - */ |
|
273 | - public function addIframeEmbedButtonsSection( array $embed_buttons ) |
|
274 | - { |
|
275 | - $embed_buttons = (array)apply_filters( |
|
276 | - 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
|
277 | - $embed_buttons |
|
278 | - ); |
|
279 | - // add button for iframe code to event editor. |
|
280 | - $html = \EEH_HTML::br( 2 ); |
|
281 | - $html .= \EEH_HTML::h3( esc_html__( 'iFrame Embed Code', 'event_espresso' ) ); |
|
282 | - $html .= \EEH_HTML::p( |
|
283 | - esc_html__( |
|
284 | - 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
|
285 | - 'event_espresso' |
|
286 | - ) |
|
287 | - ); |
|
288 | - $html .= ' ' . implode( ' ', $embed_buttons ) . ' '; |
|
289 | - $html .= \EEH_HTML::br( 2 ); |
|
290 | - return $html; |
|
291 | - } |
|
19 | + /** |
|
20 | + * @var string $iframe_name |
|
21 | + */ |
|
22 | + private $iframe_name; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var string $route_name |
|
26 | + */ |
|
27 | + private $route_name; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string $slug |
|
31 | + */ |
|
32 | + private $slug; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var boolean $append_filterable_content |
|
36 | + */ |
|
37 | + private $append_filterable_content; |
|
38 | + |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * IframeEmbedButton constructor. |
|
43 | + * |
|
44 | + * @param string $iframe_name i18n name for the iframe. This will be used in HTML |
|
45 | + * @param string $route_name the name of the registered route |
|
46 | + * @param string $slug URL slug used for the thing the iframe button is being embedded in. |
|
47 | + * will most likely be "event" since that's the only usage atm |
|
48 | + */ |
|
49 | + public function __construct( $iframe_name, $route_name, $slug = 'event' ) |
|
50 | + { |
|
51 | + $this->iframe_name = $iframe_name; |
|
52 | + $this->route_name = $route_name; |
|
53 | + $this->slug = $slug; |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * Adds an iframe embed code button to the Event editor. |
|
60 | + */ |
|
61 | + public function addEventEditorIframeEmbedButtonFilter() |
|
62 | + { |
|
63 | + // add button for iframe code to event editor. |
|
64 | + add_filter( |
|
65 | + 'get_sample_permalink_html', |
|
66 | + array( $this, 'appendIframeEmbedButtonToSamplePermalinkHtml' ), |
|
67 | + 10, |
|
68 | + 2 |
|
69 | + ); |
|
70 | + add_action( |
|
71 | + 'admin_enqueue_scripts', |
|
72 | + array( $this, 'embedButtonAssets' ), |
|
73 | + 10 |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @param $permalink_string |
|
81 | + * @param $id |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id ) |
|
85 | + { |
|
86 | + return $this->eventEditorIframeEmbedButton( |
|
87 | + $permalink_string, |
|
88 | + $id |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * iframe embed code button to the Event editor. |
|
96 | + * |
|
97 | + * @param string $permalink_string |
|
98 | + * @param int $id |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function eventEditorIframeEmbedButton( |
|
102 | + $permalink_string, |
|
103 | + $id |
|
104 | + ) { |
|
105 | + //make sure this is ONLY when editing and the event id has been set. |
|
106 | + if ( ! empty( $id ) ) { |
|
107 | + $post = get_post( $id ); |
|
108 | + //if NOT event then let's get out. |
|
109 | + if ( $post->post_type !== 'espresso_events' ) { |
|
110 | + return $permalink_string; |
|
111 | + } |
|
112 | + $permalink_string .= $this->embedButtonHtml( |
|
113 | + array( $this->slug => $id ), |
|
114 | + 'button-small' |
|
115 | + ); |
|
116 | + } |
|
117 | + return $permalink_string; |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * Adds an iframe embed code button via a WP do_action() as determined by the first parameter |
|
124 | + * |
|
125 | + * @param string $action name of the WP do_action() to hook into |
|
126 | + */ |
|
127 | + public function addActionIframeEmbedButton( $action ) |
|
128 | + { |
|
129 | + // add button for iframe code to event editor. |
|
130 | + add_action( |
|
131 | + $action, |
|
132 | + array( $this, 'addActionIframeEmbedButtonCallback' ), |
|
133 | + 10, 2 |
|
134 | + ); |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @return void |
|
141 | + */ |
|
142 | + public function addActionIframeEmbedButtonCallback() |
|
143 | + { |
|
144 | + echo $this->embedButtonHtml(); |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter |
|
151 | + * |
|
152 | + * @param string $filter name of the WP apply_filters() to hook into |
|
153 | + * @param bool $append if true, will add iframe embed button to end of content, |
|
154 | + * else if false, will add to the beginning of the content |
|
155 | + */ |
|
156 | + public function addFilterIframeEmbedButton( $filter, $append = true ) |
|
157 | + { |
|
158 | + $this->append_filterable_content = $append; |
|
159 | + // add button for iframe code to event editor. |
|
160 | + add_filter( |
|
161 | + $filter, |
|
162 | + array( $this, 'addFilterIframeEmbedButtonCallback' ), |
|
163 | + 10 |
|
164 | + ); |
|
165 | + } |
|
166 | + |
|
167 | + |
|
168 | + |
|
169 | + /** |
|
170 | + * @param array|string $filterable_content |
|
171 | + * @return array|string |
|
172 | + */ |
|
173 | + public function addFilterIframeEmbedButtonCallback( $filterable_content ) |
|
174 | + { |
|
175 | + $embedButtonHtml = $this->embedButtonHtml(); |
|
176 | + if ( is_array( $filterable_content ) ) { |
|
177 | + $filterable_content = $this->append_filterable_content |
|
178 | + ? $filterable_content + array( $this->route_name => $embedButtonHtml ) |
|
179 | + : array( $this->route_name => $embedButtonHtml ) + $filterable_content; |
|
180 | + } else { |
|
181 | + $filterable_content = $this->append_filterable_content |
|
182 | + ? $filterable_content . $embedButtonHtml |
|
183 | + : $embedButtonHtml . $filterable_content; |
|
184 | + } |
|
185 | + return $filterable_content; |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * iframe_embed_html |
|
192 | + * |
|
193 | + * @param array $query_args |
|
194 | + * @param string $button_class |
|
195 | + * @return string |
|
196 | + */ |
|
197 | + public function embedButtonHtml( $query_args = array(), $button_class = '' ) |
|
198 | + { |
|
199 | + // incoming args will replace the defaults listed here in the second array (union preserves first array) |
|
200 | + $query_args = (array)$query_args + array( $this->route_name => 'iframe' ); |
|
201 | + $query_args = (array)apply_filters( |
|
202 | + 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
|
203 | + $query_args |
|
204 | + ); |
|
205 | + // add this route to our localized vars |
|
206 | + $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] ) |
|
207 | + ? \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] |
|
208 | + : array(); |
|
209 | + $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
210 | + \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] = $iframe_module_routes; |
|
211 | + $iframe_embed_html = \EEH_HTML::link( |
|
212 | + '#', |
|
213 | + sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ), |
|
214 | + sprintf( |
|
215 | + esc_html__( |
|
216 | + 'click here to generate code for embedding %1$s iframe into another site.', |
|
217 | + 'event_espresso' |
|
218 | + ), |
|
219 | + \EEH_Inflector::add_indefinite_article( $this->iframe_name ) |
|
220 | + ), |
|
221 | + "{$this->route_name}-iframe-embed-trigger-js", |
|
222 | + 'iframe-embed-trigger-js button ' . $button_class, |
|
223 | + '', |
|
224 | + ' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"' |
|
225 | + ); |
|
226 | + $iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js', |
|
227 | + 'display:none;' ); |
|
228 | + $iframe_embed_html .= esc_html( |
|
229 | + \EEH_HTML::div( |
|
230 | + '<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>', |
|
231 | + '', |
|
232 | + '', |
|
233 | + 'width:100%; height: 500px;' |
|
234 | + ) |
|
235 | + ); |
|
236 | + $iframe_embed_html .= \EEH_HTML::divx(); |
|
237 | + return $iframe_embed_html; |
|
238 | + } |
|
239 | + |
|
240 | + |
|
241 | + |
|
242 | + /** |
|
243 | + * enqueue iframe button js |
|
244 | + */ |
|
245 | + public function embedButtonAssets() |
|
246 | + { |
|
247 | + \EE_Registry::$i18n_js_strings[ 'iframe_embed_title' ] = esc_html__( |
|
248 | + 'copy and paste the following into any other site\'s content to display this event:', |
|
249 | + 'event_espresso' |
|
250 | + ); |
|
251 | + \EE_Registry::$i18n_js_strings[ 'iframe_embed_close_msg' ] = esc_html__( |
|
252 | + 'click anywhere outside of this window to close it.', |
|
253 | + 'event_espresso' |
|
254 | + ); |
|
255 | + wp_register_script( |
|
256 | + 'iframe_embed_button', |
|
257 | + plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js', |
|
258 | + array( 'ee-dialog' ), |
|
259 | + EVENT_ESPRESSO_VERSION, |
|
260 | + true |
|
261 | + ); |
|
262 | + wp_enqueue_script( 'iframe_embed_button' ); |
|
263 | + } |
|
264 | + |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * generates embed button sections for admin pages |
|
269 | + * |
|
270 | + * @param array $embed_buttons |
|
271 | + * @return string |
|
272 | + */ |
|
273 | + public function addIframeEmbedButtonsSection( array $embed_buttons ) |
|
274 | + { |
|
275 | + $embed_buttons = (array)apply_filters( |
|
276 | + 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
|
277 | + $embed_buttons |
|
278 | + ); |
|
279 | + // add button for iframe code to event editor. |
|
280 | + $html = \EEH_HTML::br( 2 ); |
|
281 | + $html .= \EEH_HTML::h3( esc_html__( 'iFrame Embed Code', 'event_espresso' ) ); |
|
282 | + $html .= \EEH_HTML::p( |
|
283 | + esc_html__( |
|
284 | + 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
|
285 | + 'event_espresso' |
|
286 | + ) |
|
287 | + ); |
|
288 | + $html .= ' ' . implode( ' ', $embed_buttons ) . ' '; |
|
289 | + $html .= \EEH_HTML::br( 2 ); |
|
290 | + return $html; |
|
291 | + } |
|
292 | 292 | |
293 | 293 | |
294 | 294 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\iframe_display; |
3 | 3 | |
4 | -defined( 'ABSPATH' ) || exit; |
|
4 | +defined('ABSPATH') || exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string $slug URL slug used for the thing the iframe button is being embedded in. |
47 | 47 | * will most likely be "event" since that's the only usage atm |
48 | 48 | */ |
49 | - public function __construct( $iframe_name, $route_name, $slug = 'event' ) |
|
49 | + public function __construct($iframe_name, $route_name, $slug = 'event') |
|
50 | 50 | { |
51 | 51 | $this->iframe_name = $iframe_name; |
52 | 52 | $this->route_name = $route_name; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | // add button for iframe code to event editor. |
64 | 64 | add_filter( |
65 | 65 | 'get_sample_permalink_html', |
66 | - array( $this, 'appendIframeEmbedButtonToSamplePermalinkHtml' ), |
|
66 | + array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'), |
|
67 | 67 | 10, |
68 | 68 | 2 |
69 | 69 | ); |
70 | 70 | add_action( |
71 | 71 | 'admin_enqueue_scripts', |
72 | - array( $this, 'embedButtonAssets' ), |
|
72 | + array($this, 'embedButtonAssets'), |
|
73 | 73 | 10 |
74 | 74 | ); |
75 | 75 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param $id |
82 | 82 | * @return string |
83 | 83 | */ |
84 | - public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id ) |
|
84 | + public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id) |
|
85 | 85 | { |
86 | 86 | return $this->eventEditorIframeEmbedButton( |
87 | 87 | $permalink_string, |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | $id |
104 | 104 | ) { |
105 | 105 | //make sure this is ONLY when editing and the event id has been set. |
106 | - if ( ! empty( $id ) ) { |
|
107 | - $post = get_post( $id ); |
|
106 | + if ( ! empty($id)) { |
|
107 | + $post = get_post($id); |
|
108 | 108 | //if NOT event then let's get out. |
109 | - if ( $post->post_type !== 'espresso_events' ) { |
|
109 | + if ($post->post_type !== 'espresso_events') { |
|
110 | 110 | return $permalink_string; |
111 | 111 | } |
112 | 112 | $permalink_string .= $this->embedButtonHtml( |
113 | - array( $this->slug => $id ), |
|
113 | + array($this->slug => $id), |
|
114 | 114 | 'button-small' |
115 | 115 | ); |
116 | 116 | } |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $action name of the WP do_action() to hook into |
126 | 126 | */ |
127 | - public function addActionIframeEmbedButton( $action ) |
|
127 | + public function addActionIframeEmbedButton($action) |
|
128 | 128 | { |
129 | 129 | // add button for iframe code to event editor. |
130 | 130 | add_action( |
131 | 131 | $action, |
132 | - array( $this, 'addActionIframeEmbedButtonCallback' ), |
|
132 | + array($this, 'addActionIframeEmbedButtonCallback'), |
|
133 | 133 | 10, 2 |
134 | 134 | ); |
135 | 135 | } |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * @param bool $append if true, will add iframe embed button to end of content, |
154 | 154 | * else if false, will add to the beginning of the content |
155 | 155 | */ |
156 | - public function addFilterIframeEmbedButton( $filter, $append = true ) |
|
156 | + public function addFilterIframeEmbedButton($filter, $append = true) |
|
157 | 157 | { |
158 | 158 | $this->append_filterable_content = $append; |
159 | 159 | // add button for iframe code to event editor. |
160 | 160 | add_filter( |
161 | 161 | $filter, |
162 | - array( $this, 'addFilterIframeEmbedButtonCallback' ), |
|
162 | + array($this, 'addFilterIframeEmbedButtonCallback'), |
|
163 | 163 | 10 |
164 | 164 | ); |
165 | 165 | } |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | * @param array|string $filterable_content |
171 | 171 | * @return array|string |
172 | 172 | */ |
173 | - public function addFilterIframeEmbedButtonCallback( $filterable_content ) |
|
173 | + public function addFilterIframeEmbedButtonCallback($filterable_content) |
|
174 | 174 | { |
175 | 175 | $embedButtonHtml = $this->embedButtonHtml(); |
176 | - if ( is_array( $filterable_content ) ) { |
|
176 | + if (is_array($filterable_content)) { |
|
177 | 177 | $filterable_content = $this->append_filterable_content |
178 | - ? $filterable_content + array( $this->route_name => $embedButtonHtml ) |
|
179 | - : array( $this->route_name => $embedButtonHtml ) + $filterable_content; |
|
178 | + ? $filterable_content + array($this->route_name => $embedButtonHtml) |
|
179 | + : array($this->route_name => $embedButtonHtml) + $filterable_content; |
|
180 | 180 | } else { |
181 | 181 | $filterable_content = $this->append_filterable_content |
182 | - ? $filterable_content . $embedButtonHtml |
|
183 | - : $embedButtonHtml . $filterable_content; |
|
182 | + ? $filterable_content.$embedButtonHtml |
|
183 | + : $embedButtonHtml.$filterable_content; |
|
184 | 184 | } |
185 | 185 | return $filterable_content; |
186 | 186 | } |
@@ -194,40 +194,40 @@ discard block |
||
194 | 194 | * @param string $button_class |
195 | 195 | * @return string |
196 | 196 | */ |
197 | - public function embedButtonHtml( $query_args = array(), $button_class = '' ) |
|
197 | + public function embedButtonHtml($query_args = array(), $button_class = '') |
|
198 | 198 | { |
199 | 199 | // incoming args will replace the defaults listed here in the second array (union preserves first array) |
200 | - $query_args = (array)$query_args + array( $this->route_name => 'iframe' ); |
|
201 | - $query_args = (array)apply_filters( |
|
200 | + $query_args = (array) $query_args + array($this->route_name => 'iframe'); |
|
201 | + $query_args = (array) apply_filters( |
|
202 | 202 | 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
203 | 203 | $query_args |
204 | 204 | ); |
205 | 205 | // add this route to our localized vars |
206 | - $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] ) |
|
207 | - ? \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] |
|
206 | + $iframe_module_routes = isset(\EE_Registry::$i18n_js_strings['iframe_module_routes']) |
|
207 | + ? \EE_Registry::$i18n_js_strings['iframe_module_routes'] |
|
208 | 208 | : array(); |
209 | - $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
210 | - \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] = $iframe_module_routes; |
|
209 | + $iframe_module_routes[$this->route_name] = $this->route_name; |
|
210 | + \EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes; |
|
211 | 211 | $iframe_embed_html = \EEH_HTML::link( |
212 | 212 | '#', |
213 | - sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ), |
|
213 | + sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name), |
|
214 | 214 | sprintf( |
215 | 215 | esc_html__( |
216 | 216 | 'click here to generate code for embedding %1$s iframe into another site.', |
217 | 217 | 'event_espresso' |
218 | 218 | ), |
219 | - \EEH_Inflector::add_indefinite_article( $this->iframe_name ) |
|
219 | + \EEH_Inflector::add_indefinite_article($this->iframe_name) |
|
220 | 220 | ), |
221 | 221 | "{$this->route_name}-iframe-embed-trigger-js", |
222 | - 'iframe-embed-trigger-js button ' . $button_class, |
|
222 | + 'iframe-embed-trigger-js button '.$button_class, |
|
223 | 223 | '', |
224 | - ' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"' |
|
224 | + ' data-iframe_embed_button="#'.$this->route_name.'-iframe-js" tabindex="-1"' |
|
225 | 225 | ); |
226 | - $iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js', |
|
227 | - 'display:none;' ); |
|
226 | + $iframe_embed_html .= \EEH_HTML::div('', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js', |
|
227 | + 'display:none;'); |
|
228 | 228 | $iframe_embed_html .= esc_html( |
229 | 229 | \EEH_HTML::div( |
230 | - '<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>', |
|
230 | + '<iframe src="'.add_query_arg($query_args, site_url()).'" width="100%" height="100%"></iframe>', |
|
231 | 231 | '', |
232 | 232 | '', |
233 | 233 | 'width:100%; height: 500px;' |
@@ -244,22 +244,22 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function embedButtonAssets() |
246 | 246 | { |
247 | - \EE_Registry::$i18n_js_strings[ 'iframe_embed_title' ] = esc_html__( |
|
247 | + \EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__( |
|
248 | 248 | 'copy and paste the following into any other site\'s content to display this event:', |
249 | 249 | 'event_espresso' |
250 | 250 | ); |
251 | - \EE_Registry::$i18n_js_strings[ 'iframe_embed_close_msg' ] = esc_html__( |
|
251 | + \EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__( |
|
252 | 252 | 'click anywhere outside of this window to close it.', |
253 | 253 | 'event_espresso' |
254 | 254 | ); |
255 | 255 | wp_register_script( |
256 | 256 | 'iframe_embed_button', |
257 | - plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js', |
|
258 | - array( 'ee-dialog' ), |
|
257 | + plugin_dir_url(__FILE__).'iframe-embed-button.js', |
|
258 | + array('ee-dialog'), |
|
259 | 259 | EVENT_ESPRESSO_VERSION, |
260 | 260 | true |
261 | 261 | ); |
262 | - wp_enqueue_script( 'iframe_embed_button' ); |
|
262 | + wp_enqueue_script('iframe_embed_button'); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -270,23 +270,23 @@ discard block |
||
270 | 270 | * @param array $embed_buttons |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public function addIframeEmbedButtonsSection( array $embed_buttons ) |
|
273 | + public function addIframeEmbedButtonsSection(array $embed_buttons) |
|
274 | 274 | { |
275 | - $embed_buttons = (array)apply_filters( |
|
275 | + $embed_buttons = (array) apply_filters( |
|
276 | 276 | 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
277 | 277 | $embed_buttons |
278 | 278 | ); |
279 | 279 | // add button for iframe code to event editor. |
280 | - $html = \EEH_HTML::br( 2 ); |
|
281 | - $html .= \EEH_HTML::h3( esc_html__( 'iFrame Embed Code', 'event_espresso' ) ); |
|
280 | + $html = \EEH_HTML::br(2); |
|
281 | + $html .= \EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso')); |
|
282 | 282 | $html .= \EEH_HTML::p( |
283 | 283 | esc_html__( |
284 | 284 | 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
285 | 285 | 'event_espresso' |
286 | 286 | ) |
287 | 287 | ); |
288 | - $html .= ' ' . implode( ' ', $embed_buttons ) . ' '; |
|
289 | - $html .= \EEH_HTML::br( 2 ); |
|
288 | + $html .= ' '.implode(' ', $embed_buttons).' '; |
|
289 | + $html .= \EEH_HTML::br(2); |
|
290 | 290 | return $html; |
291 | 291 | } |
292 | 292 |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class EED_Ticket_Selector extends EED_Module { |
24 | 24 | |
25 | - /** |
|
26 | - * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector |
|
27 | - */ |
|
28 | - private static $ticket_selector; |
|
25 | + /** |
|
26 | + * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector |
|
27 | + */ |
|
28 | + private static $ticket_selector; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button |
|
32 | - */ |
|
33 | - private static $iframe_embed_button; |
|
30 | + /** |
|
31 | + * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button |
|
32 | + */ |
|
33 | + private static $iframe_embed_button; |
|
34 | 34 | |
35 | 35 | |
36 | 36 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | array( 'EED_Ticket_Selector', 'ticket_selector_iframe_embed_button' ), |
83 | 83 | 10 |
84 | 84 | ); |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | 88 | |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | |
107 | 107 | |
108 | 108 | /** |
109 | - * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector |
|
110 | - */ |
|
111 | - public static function ticketSelector() |
|
112 | - { |
|
113 | - if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
114 | - EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector(); |
|
115 | - } |
|
116 | - return EED_Ticket_Selector::$ticket_selector; |
|
117 | - } |
|
109 | + * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector |
|
110 | + */ |
|
111 | + public static function ticketSelector() |
|
112 | + { |
|
113 | + if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
114 | + EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector(); |
|
115 | + } |
|
116 | + return EED_Ticket_Selector::$ticket_selector; |
|
117 | + } |
|
118 | 118 | |
119 | 119 | |
120 | 120 | /** |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | |
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * creates buttons for selecting number of attendees for an event |
|
171 | - * |
|
172 | - * @access public |
|
173 | - * @param WP_Post|int $event |
|
174 | - * @param bool $view_details |
|
175 | - * @return string |
|
176 | - * @throws \EE_Error |
|
177 | - */ |
|
169 | + /** |
|
170 | + * creates buttons for selecting number of attendees for an event |
|
171 | + * |
|
172 | + * @access public |
|
173 | + * @param WP_Post|int $event |
|
174 | + * @param bool $view_details |
|
175 | + * @return string |
|
176 | + * @throws \EE_Error |
|
177 | + */ |
|
178 | 178 | public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
179 | 179 | return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details ); |
180 | 180 | } |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | |
198 | 198 | |
199 | 199 | /** |
200 | - * load js |
|
201 | - * |
|
202 | - * @access public |
|
203 | - * @return void |
|
204 | - */ |
|
200 | + * load js |
|
201 | + * |
|
202 | + * @access public |
|
203 | + * @return void |
|
204 | + */ |
|
205 | 205 | public static function load_tckt_slctr_assets() { |
206 | 206 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
207 | 207 | // add some style |
@@ -219,129 +219,129 @@ discard block |
||
219 | 219 | |
220 | 220 | |
221 | 221 | |
222 | - /** |
|
223 | - * @deprecated |
|
224 | - * @return string |
|
225 | - * @throws \EE_Error |
|
226 | - */ |
|
227 | - public static function display_view_details_btn() |
|
228 | - { |
|
229 | - // todo add doing_it_wrong() notice during next major version |
|
230 | - return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
231 | - } |
|
232 | - |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * @deprecated |
|
237 | - * @return string |
|
238 | - * @throws \EE_Error |
|
239 | - */ |
|
240 | - public static function display_ticket_selector_submit() |
|
241 | - { |
|
242 | - // todo add doing_it_wrong() notice during next major version |
|
243 | - return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - |
|
248 | - /** |
|
249 | - * @deprecated |
|
250 | - * @param string $permalink_string |
|
251 | - * @param int $id |
|
252 | - * @param string $new_title |
|
253 | - * @param string $new_slug |
|
254 | - * @return string |
|
255 | - */ |
|
256 | - public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
257 | - { |
|
258 | - // todo add doing_it_wrong() notice during next major version |
|
259 | - if ( |
|
260 | - \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
261 | - && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
262 | - ) { |
|
263 | - $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
264 | - $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
265 | - } |
|
266 | - return ''; |
|
267 | - } |
|
268 | - |
|
269 | - |
|
270 | - |
|
271 | - /** |
|
272 | - * @deprecated |
|
273 | - * @param int $ID |
|
274 | - * @param string $external_url |
|
275 | - * @return string |
|
276 | - */ |
|
277 | - public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
278 | - { |
|
279 | - // todo add doing_it_wrong() notice during next major version |
|
280 | - return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
281 | - } |
|
282 | - |
|
283 | - |
|
284 | - |
|
285 | - /** |
|
286 | - * @deprecated |
|
287 | - * @return string |
|
288 | - */ |
|
289 | - public static function ticket_selector_form_close() |
|
290 | - { |
|
291 | - // todo add doing_it_wrong() notice during next major version |
|
292 | - return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - |
|
297 | - /** |
|
298 | - * @deprecated |
|
299 | - * @return string |
|
300 | - */ |
|
301 | - public static function no_tkt_slctr_end_dv() |
|
302 | - { |
|
303 | - // todo add doing_it_wrong() notice during next major version |
|
304 | - return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv(); |
|
305 | - } |
|
306 | - |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * @deprecated 4.9.13 |
|
311 | - * @return string |
|
312 | - */ |
|
313 | - public static function tkt_slctr_end_dv() |
|
314 | - { |
|
315 | - return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
316 | - } |
|
317 | - |
|
318 | - |
|
319 | - |
|
320 | - /** |
|
321 | - * @deprecated |
|
322 | - * @return string |
|
323 | - */ |
|
324 | - public static function clear_tkt_slctr() |
|
325 | - { |
|
326 | - return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
327 | - } |
|
328 | - |
|
329 | - |
|
330 | - |
|
331 | - /** |
|
332 | - * @deprecated |
|
333 | - */ |
|
334 | - public static function load_tckt_slctr_assets_admin() |
|
335 | - { |
|
336 | - // todo add doing_it_wrong() notice during next major version |
|
337 | - if ( |
|
338 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
339 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
340 | - ) { |
|
341 | - $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
342 | - $iframe_embed_button::embedButtonAssets(); |
|
343 | - } |
|
344 | - } |
|
222 | + /** |
|
223 | + * @deprecated |
|
224 | + * @return string |
|
225 | + * @throws \EE_Error |
|
226 | + */ |
|
227 | + public static function display_view_details_btn() |
|
228 | + { |
|
229 | + // todo add doing_it_wrong() notice during next major version |
|
230 | + return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
231 | + } |
|
232 | + |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * @deprecated |
|
237 | + * @return string |
|
238 | + * @throws \EE_Error |
|
239 | + */ |
|
240 | + public static function display_ticket_selector_submit() |
|
241 | + { |
|
242 | + // todo add doing_it_wrong() notice during next major version |
|
243 | + return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + |
|
248 | + /** |
|
249 | + * @deprecated |
|
250 | + * @param string $permalink_string |
|
251 | + * @param int $id |
|
252 | + * @param string $new_title |
|
253 | + * @param string $new_slug |
|
254 | + * @return string |
|
255 | + */ |
|
256 | + public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
257 | + { |
|
258 | + // todo add doing_it_wrong() notice during next major version |
|
259 | + if ( |
|
260 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
261 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
262 | + ) { |
|
263 | + $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
264 | + $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
265 | + } |
|
266 | + return ''; |
|
267 | + } |
|
268 | + |
|
269 | + |
|
270 | + |
|
271 | + /** |
|
272 | + * @deprecated |
|
273 | + * @param int $ID |
|
274 | + * @param string $external_url |
|
275 | + * @return string |
|
276 | + */ |
|
277 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
278 | + { |
|
279 | + // todo add doing_it_wrong() notice during next major version |
|
280 | + return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
281 | + } |
|
282 | + |
|
283 | + |
|
284 | + |
|
285 | + /** |
|
286 | + * @deprecated |
|
287 | + * @return string |
|
288 | + */ |
|
289 | + public static function ticket_selector_form_close() |
|
290 | + { |
|
291 | + // todo add doing_it_wrong() notice during next major version |
|
292 | + return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + |
|
297 | + /** |
|
298 | + * @deprecated |
|
299 | + * @return string |
|
300 | + */ |
|
301 | + public static function no_tkt_slctr_end_dv() |
|
302 | + { |
|
303 | + // todo add doing_it_wrong() notice during next major version |
|
304 | + return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv(); |
|
305 | + } |
|
306 | + |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * @deprecated 4.9.13 |
|
311 | + * @return string |
|
312 | + */ |
|
313 | + public static function tkt_slctr_end_dv() |
|
314 | + { |
|
315 | + return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
316 | + } |
|
317 | + |
|
318 | + |
|
319 | + |
|
320 | + /** |
|
321 | + * @deprecated |
|
322 | + * @return string |
|
323 | + */ |
|
324 | + public static function clear_tkt_slctr() |
|
325 | + { |
|
326 | + return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
327 | + } |
|
328 | + |
|
329 | + |
|
330 | + |
|
331 | + /** |
|
332 | + * @deprecated |
|
333 | + */ |
|
334 | + public static function load_tckt_slctr_assets_admin() |
|
335 | + { |
|
336 | + // todo add doing_it_wrong() notice during next major version |
|
337 | + if ( |
|
338 | + \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
339 | + && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
340 | + ) { |
|
341 | + $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
342 | + $iframe_embed_button::embedButtonAssets(); |
|
343 | + } |
|
344 | + } |
|
345 | 345 | |
346 | 346 | |
347 | 347 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | use EventEspresso\modules\ticket_selector\TicketSelectorIframe; |
4 | 4 | use EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | * @return EED_Ticket_Selector |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - return parent::get_instance( __CLASS__ ); |
|
41 | + return parent::get_instance(__CLASS__); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - protected function set_config(){ |
|
47 | - $this->set_config_section( 'template_settings' ); |
|
48 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
49 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
46 | + protected function set_config() { |
|
47 | + $this->set_config_section('template_settings'); |
|
48 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
49 | + $this->set_config_name('EED_Ticket_Selector'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function set_hooks() { |
61 | 61 | // routing |
62 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
63 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
64 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
65 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
66 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
62 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
63 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
64 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
65 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
66 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // to load assets for "espresso_events" page on the "edit" route (action) |
80 | 80 | add_action( |
81 | 81 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__edit', |
82 | - array( 'EED_Ticket_Selector', 'ticket_selector_iframe_embed_button' ), |
|
82 | + array('EED_Ticket_Selector', 'ticket_selector_iframe_embed_button'), |
|
83 | 83 | 10 |
84 | 84 | ); |
85 | 85 | } |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public static function set_definitions() { |
96 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
97 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
96 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
97 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | |
99 | 99 | //if config is not set, initialize |
100 | 100 | //If config is not set, set it. |
101 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
101 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
102 | 102 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
103 | 103 | } |
104 | 104 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param WP $WP |
125 | 125 | * @return void |
126 | 126 | */ |
127 | - public function run( $WP ) {} |
|
127 | + public function run($WP) {} |
|
128 | 128 | |
129 | 129 | |
130 | 130 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return \EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton |
133 | 133 | */ |
134 | 134 | public static function getIframeEmbedButton() { |
135 | - if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton ) { |
|
135 | + if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
136 | 136 | self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
137 | 137 | } |
138 | 138 | return self::$iframe_embed_button; |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @return string |
176 | 176 | * @throws \EE_Error |
177 | 177 | */ |
178 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
179 | - return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details ); |
|
178 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
179 | + return EED_Ticket_Selector::ticketSelector()->display($event, $view_details); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * @return void |
204 | 204 | */ |
205 | 205 | public static function load_tckt_slctr_assets() { |
206 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
206 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
207 | 207 | // add some style |
208 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
208 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
209 | 209 | wp_enqueue_style('ticket_selector'); |
210 | 210 | // make it dance |
211 | 211 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | { |
336 | 336 | // todo add doing_it_wrong() notice during next major version |
337 | 337 | if ( |
338 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
339 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
338 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
339 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
340 | 340 | ) { |
341 | 341 | $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
342 | 342 | $iframe_embed_button::embedButtonAssets(); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton; |
4 | 4 | use EventEspresso\modules\events_archive\EventsArchiveIframe; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
7 | 7 | /** |
8 | 8 | * Event Espresso |
9 | 9 | * |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return EED_Events_Archive |
54 | 54 | */ |
55 | 55 | public static function instance() { |
56 | - return parent::get_instance( __CLASS__ ); |
|
56 | + return parent::get_instance(__CLASS__); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | * @return void |
66 | 66 | */ |
67 | 67 | public static function set_hooks() { |
68 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
69 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
70 | - EE_Config::register_route( 'iframe', 'Events_Archive', 'event_list_iframe', 'event_list' ); |
|
71 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
68 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
69 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
70 | + EE_Config::register_route('iframe', 'Events_Archive', 'event_list_iframe', 'event_list'); |
|
71 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_hooks_admin() { |
81 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
81 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
82 | 82 | // hook into the end of the \EE_Admin_Page::_load_page_dependencies() |
83 | 83 | // to load assets for "espresso_events" page on the "default" route (action) |
84 | 84 | add_action( |
85 | 85 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__default', |
86 | - array( 'EED_Events_Archive', 'event_list_iframe_embed_button' ), |
|
86 | + array('EED_Events_Archive', 'event_list_iframe_embed_button'), |
|
87 | 87 | 10 |
88 | 88 | ); |
89 | 89 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | public static function set_definitions() { |
101 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
102 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
101 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
102 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * set up EE_Events_Archive_Config |
109 | 109 | */ |
110 | - protected function set_config(){ |
|
111 | - $this->set_config_section( 'template_settings' ); |
|
112 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
113 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
110 | + protected function set_config() { |
|
111 | + $this->set_config_section('template_settings'); |
|
112 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
113 | + $this->set_config_name('EED_Events_Archive'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return EventListIframeEmbedButton |
120 | 120 | */ |
121 | 121 | public static function get_iframe_embed_button() { |
122 | - if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton ) { |
|
122 | + if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) { |
|
123 | 123 | self::$_iframe_embed_button = new EventListIframeEmbedButton(); |
124 | 124 | } |
125 | 125 | return self::$_iframe_embed_button; |
@@ -145,35 +145,35 @@ discard block |
||
145 | 145 | * @param \EE_Events_Archive_Config $config |
146 | 146 | * @return \EE_Template_Part_Manager |
147 | 147 | */ |
148 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
148 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
149 | 149 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
150 | 150 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
151 | 151 | $template_parts = new EE_Template_Part_Manager(); |
152 | 152 | $template_parts->add_template_part( |
153 | 153 | 'tickets', |
154 | - __( 'Ticket Selector', 'event_espresso' ), |
|
154 | + __('Ticket Selector', 'event_espresso'), |
|
155 | 155 | 'content-espresso_events-tickets.php', |
156 | 156 | $config->display_order_tickets |
157 | 157 | ); |
158 | 158 | $template_parts->add_template_part( |
159 | 159 | 'datetimes', |
160 | - __( 'Dates and Times', 'event_espresso' ), |
|
160 | + __('Dates and Times', 'event_espresso'), |
|
161 | 161 | 'content-espresso_events-datetimes.php', |
162 | 162 | $config->display_order_datetimes |
163 | 163 | ); |
164 | 164 | $template_parts->add_template_part( |
165 | 165 | 'event', |
166 | - __( 'Event Description', 'event_espresso' ), |
|
166 | + __('Event Description', 'event_espresso'), |
|
167 | 167 | 'content-espresso_events-details.php', |
168 | 168 | $config->display_order_event |
169 | 169 | ); |
170 | 170 | $template_parts->add_template_part( |
171 | 171 | 'venue', |
172 | - __( 'Venue Information', 'event_espresso' ), |
|
172 | + __('Venue Information', 'event_espresso'), |
|
173 | 173 | 'content-espresso_events-venues.php', |
174 | 174 | $config->display_order_venue |
175 | 175 | ); |
176 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
176 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
177 | 177 | return $template_parts; |
178 | 178 | } |
179 | 179 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param WP $WP |
187 | 187 | * @return void |
188 | 188 | */ |
189 | - public function run( $WP ) { |
|
190 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
189 | + public function run($WP) { |
|
190 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
191 | 191 | // ensure valid EE_Events_Archive_Config() object exists |
192 | 192 | $this->set_config(); |
193 | 193 | /** @type EE_Events_Archive_Config $config */ |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | EEH_Event_Query::add_query_filters(); |
200 | 200 | // set params that will get used by the filters |
201 | 201 | EEH_Event_Query::set_query_params( |
202 | - '', // month |
|
203 | - '', // category |
|
204 | - $config->display_expired_events, // show_expired |
|
205 | - 'start_date', // orderby |
|
202 | + '', // month |
|
203 | + '', // category |
|
204 | + $config->display_expired_events, // show_expired |
|
205 | + 'start_date', // orderby |
|
206 | 206 | 'ASC' // sort |
207 | 207 | ); |
208 | 208 | // check what template is loaded |
209 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
209 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @throws \EE_Error |
233 | 233 | */ |
234 | 234 | public function event_list_iframe() { |
235 | - $event_list_iframe = new EventsArchiveIframe( $this ); |
|
235 | + $event_list_iframe = new EventsArchiveIframe($this); |
|
236 | 236 | $event_list_iframe->display(); |
237 | 237 | } |
238 | 238 | |
@@ -250,32 +250,32 @@ discard block |
||
250 | 250 | * @param string $template |
251 | 251 | * @return string |
252 | 252 | */ |
253 | - public function template_include( $template = '' ) { |
|
253 | + public function template_include($template = '') { |
|
254 | 254 | // don't add content filter for dedicated EE child themes or private posts |
255 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
255 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
256 | 256 | /** @type EE_Events_Archive_Config $config */ |
257 | 257 | $config = $this->config(); |
258 | 258 | // add status banner ? |
259 | - if ( $config->display_status_banner ) { |
|
260 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
259 | + if ($config->display_status_banner) { |
|
260 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
261 | 261 | } |
262 | 262 | // if NOT a custom template |
263 | 263 | if ( |
264 | - EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_events.php' |
|
265 | - || apply_filters( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE ) |
|
264 | + EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_events.php' |
|
265 | + || apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE) |
|
266 | 266 | ) { |
267 | 267 | // don't display entry meta because the existing theme will take care of that |
268 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
268 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
269 | 269 | // load functions.php file for the theme (loaded by WP if using child theme) |
270 | 270 | EEH_Template::load_espresso_theme_functions(); |
271 | 271 | // because we don't know if the theme is using the_excerpt() |
272 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
272 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
273 | 273 | // or the_content |
274 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
274 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
275 | 275 | // and just in case they are running get_the_excerpt() which DESTROYS things |
276 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
276 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
277 | 277 | // don't display entry meta because the existing theme will take care of that |
278 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
278 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | return $template; |
@@ -290,17 +290,17 @@ discard block |
||
290 | 290 | * @param string $excerpt |
291 | 291 | * @return string |
292 | 292 | */ |
293 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
294 | - if ( post_password_required() ) { |
|
293 | + public static function get_the_excerpt($excerpt = '') { |
|
294 | + if (post_password_required()) { |
|
295 | 295 | return $excerpt; |
296 | 296 | } |
297 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
298 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
299 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
300 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
297 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
298 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
299 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
300 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
301 | 301 | } else { |
302 | 302 | EED_Events_Archive::$using_get_the_excerpt = true; |
303 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
303 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
304 | 304 | } |
305 | 305 | return $excerpt; |
306 | 306 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param string $text |
315 | 315 | * @return string |
316 | 316 | */ |
317 | - public static function end_get_the_excerpt( $text = '' ) { |
|
317 | + public static function end_get_the_excerpt($text = '') { |
|
318 | 318 | EED_Events_Archive::$using_get_the_excerpt = false; |
319 | 319 | return $text; |
320 | 320 | } |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | * @param string $id |
330 | 330 | * @return string |
331 | 331 | */ |
332 | - public static function the_title( $title = '', $id = '' ) { |
|
332 | + public static function the_title($title = '', $id = '') { |
|
333 | 333 | global $post; |
334 | - if ( $post instanceof WP_Post ) { |
|
335 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
334 | + if ($post instanceof WP_Post) { |
|
335 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
336 | 336 | } |
337 | 337 | return $title; |
338 | 338 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param string $content |
347 | 347 | * @return string |
348 | 348 | */ |
349 | - public static function event_details( $content ) { |
|
349 | + public static function event_details($content) { |
|
350 | 350 | global $post; |
351 | 351 | static $current_post_ID = 0; |
352 | 352 | if ( |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | && ! EED_Events_Archive::$using_get_the_excerpt |
356 | 356 | && ! post_password_required() |
357 | 357 | && ( |
358 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
359 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
358 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
359 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
360 | 360 | ) |
361 | 361 | ) { |
362 | 362 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
366 | 366 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
367 | 367 | // so the following allows this filter to be applied multiple times, but only once for real |
368 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
369 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
368 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
369 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
370 | 370 | $content = \EED_Events_Archive::use_sortable_display_order(); |
371 | 371 | } else { |
372 | 372 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | */ |
386 | 386 | protected static function use_sortable_display_order() { |
387 | 387 | // no further password checks required atm |
388 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
388 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
389 | 389 | // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) |
390 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
391 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
392 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
390 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
391 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
392 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
393 | 393 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
394 | 394 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
395 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
396 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
395 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
396 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
397 | 397 | // re-add our main filters (or else the next event won't have them) |
398 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
399 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
400 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
401 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
398 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
399 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
400 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
401 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
402 | 402 | return $content; |
403 | 403 | } |
404 | 404 | |
@@ -413,22 +413,22 @@ discard block |
||
413 | 413 | protected static function use_filterable_display_order() { |
414 | 414 | // we need to first remove this callback from being applied to the_content() |
415 | 415 | // (otherwise it will recurse and blow up the interweb) |
416 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
417 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
418 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
416 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
417 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
418 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
419 | 419 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
420 | 420 | EED_Events_Archive::_add_additional_excerpt_filters(); |
421 | 421 | EED_Events_Archive::_add_additional_content_filters(); |
422 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
422 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
423 | 423 | // now load our template |
424 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
424 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
425 | 425 | // re-add our main filters (or else the next event won't have them) |
426 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
427 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
428 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
426 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
427 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
428 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
429 | 429 | // but remove the other filters so that they don't get applied to the next post |
430 | 430 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
431 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
431 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
432 | 432 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
433 | 433 | //return ! empty( $template ) ? $template : $content; |
434 | 434 | return $content; |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | * @param string $content |
444 | 444 | * @return string |
445 | 445 | */ |
446 | - public static function event_datetimes( $content ) { |
|
447 | - if ( post_password_required() ) { |
|
446 | + public static function event_datetimes($content) { |
|
447 | + if (post_password_required()) { |
|
448 | 448 | return $content; |
449 | 449 | } |
450 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
450 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * @param string $content |
458 | 458 | * @return string |
459 | 459 | */ |
460 | - public static function event_tickets( $content ) { |
|
461 | - if ( post_password_required() ) { |
|
460 | + public static function event_tickets($content) { |
|
461 | + if (post_password_required()) { |
|
462 | 462 | return $content; |
463 | 463 | } |
464 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
464 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | * @param string $content |
474 | 474 | * @return string |
475 | 475 | */ |
476 | - public static function event_venue( $content ) { |
|
477 | - return EED_Events_Archive::event_venues( $content ); |
|
476 | + public static function event_venue($content) { |
|
477 | + return EED_Events_Archive::event_venues($content); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | * @param string $content |
485 | 485 | * @return string |
486 | 486 | */ |
487 | - public static function event_venues( $content ) { |
|
488 | - if ( post_password_required() ) { |
|
487 | + public static function event_venues($content) { |
|
488 | + if (post_password_required()) { |
|
489 | 489 | return $content; |
490 | 490 | } |
491 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
491 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | * @return void |
501 | 501 | */ |
502 | 502 | private static function _add_additional_excerpt_filters() { |
503 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
504 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
505 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
503 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
504 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
505 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | |
@@ -514,9 +514,9 @@ discard block |
||
514 | 514 | * @return void |
515 | 515 | */ |
516 | 516 | private static function _add_additional_content_filters() { |
517 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
518 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
519 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
517 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
518 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
519 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,12 +528,12 @@ discard block |
||
528 | 528 | * @return void |
529 | 529 | */ |
530 | 530 | private static function _remove_additional_events_archive_filters() { |
531 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
532 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
533 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
534 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
535 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
536 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
531 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
532 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
533 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
534 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
535 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
536 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -546,17 +546,17 @@ discard block |
||
546 | 546 | */ |
547 | 547 | public static function remove_all_events_archive_filters() { |
548 | 548 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
549 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
550 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
551 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
552 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
553 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
554 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
555 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
556 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
557 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
549 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
550 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
551 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
552 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
553 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
554 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
555 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
556 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
557 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
558 | 558 | // don't display entry meta because the existing theme will take care of that |
559 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
559 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | * @return void |
572 | 572 | */ |
573 | 573 | public function load_event_list_assets() { |
574 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
575 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
576 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
577 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
578 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
579 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
574 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
575 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
576 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
577 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
578 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
579 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function wp_enqueue_scripts() { |
595 | 595 | // get some style |
596 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
596 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
597 | 597 | // first check uploads folder |
598 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
599 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
598 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
599 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
600 | 600 | } else { |
601 | 601 | } |
602 | - wp_enqueue_style( $this->theme ); |
|
602 | + wp_enqueue_style($this->theme); |
|
603 | 603 | |
604 | 604 | } |
605 | 605 | } |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | */ |
618 | 618 | public static function template_settings_form() { |
619 | 619 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
620 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
621 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
620 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
621 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
622 | 622 | $events_archive_settings = array( |
623 | 623 | 'display_status_banner' => 0, |
624 | 624 | 'display_description' => 1, |
@@ -627,8 +627,8 @@ discard block |
||
627 | 627 | 'display_venue' => 0, |
628 | 628 | 'display_expired_events' => 0 |
629 | 629 | ); |
630 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
631 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
630 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
631 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | |
@@ -644,16 +644,16 @@ discard block |
||
644 | 644 | * @param EE_Request_Handler $REQ |
645 | 645 | * @return EE_Template_Config |
646 | 646 | */ |
647 | - public static function update_template_settings( $CFG, $REQ ) { |
|
647 | + public static function update_template_settings($CFG, $REQ) { |
|
648 | 648 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
649 | 649 | // unless we are resetting the config... |
650 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
651 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
652 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
653 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
654 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
655 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
656 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
650 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
651 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
652 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
653 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
654 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
655 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
656 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
657 | 657 | return $CFG; |
658 | 658 | } |
659 | 659 | |
@@ -666,10 +666,10 @@ discard block |
||
666 | 666 | * @param string $extra_class |
667 | 667 | * @return string |
668 | 668 | */ |
669 | - public static function event_list_css( $extra_class = '' ) { |
|
670 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
669 | + public static function event_list_css($extra_class = '') { |
|
670 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
671 | 671 | $event_list_css[] = 'espresso-event-list-event'; |
672 | - return implode( ' ', $event_list_css ); |
|
672 | + return implode(' ', $event_list_css); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -696,9 +696,9 @@ discard block |
||
696 | 696 | * @param $value |
697 | 697 | * @return bool |
698 | 698 | */ |
699 | - public static function display_description( $value ) { |
|
699 | + public static function display_description($value) { |
|
700 | 700 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
701 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
701 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
702 | 702 | return $display_description === $value ? TRUE : FALSE; |
703 | 703 | } |
704 | 704 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | */ |
712 | 712 | public static function display_ticket_selector() { |
713 | 713 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
714 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
714 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | */ |
725 | 725 | public static function display_venue() { |
726 | 726 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
727 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
727 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | */ |
737 | 737 | public static function display_datetimes() { |
738 | 738 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
739 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
739 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | * @return string |
752 | 752 | */ |
753 | 753 | public static function event_list_title() { |
754 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
754 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | |
@@ -760,11 +760,11 @@ discard block |
||
760 | 760 | /** |
761 | 761 | * @since 4.4.0 |
762 | 762 | */ |
763 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
763 | + public static function _doing_it_wrong_notice($function = '') { |
|
764 | 764 | EE_Error::doing_it_wrong( |
765 | 765 | __FUNCTION__, |
766 | 766 | sprintf( |
767 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
767 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
768 | 768 | $function, |
769 | 769 | '<br />', |
770 | 770 | '4.6.0' |
@@ -786,89 +786,89 @@ discard block |
||
786 | 786 | * @deprecated |
787 | 787 | * @since 4.4.0 |
788 | 788 | */ |
789 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
790 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
791 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
789 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
790 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
791 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
792 | 792 | } |
793 | 793 | /** |
794 | 794 | * @deprecated |
795 | 795 | * @since 4.4.0 |
796 | 796 | */ |
797 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
798 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
799 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
797 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
798 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
799 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
800 | 800 | } |
801 | 801 | /** |
802 | 802 | * @deprecated |
803 | 803 | * @since 4.4.0 |
804 | 804 | */ |
805 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
806 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
807 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
805 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
806 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
807 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
808 | 808 | } |
809 | 809 | /** |
810 | 810 | * @deprecated |
811 | 811 | * @since 4.4.0 |
812 | 812 | */ |
813 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
814 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
815 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
813 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
814 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
815 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
816 | 816 | } |
817 | 817 | /** |
818 | 818 | * @deprecated |
819 | 819 | * @since 4.4.0 |
820 | 820 | */ |
821 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
822 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
823 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
821 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
822 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
823 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
824 | 824 | } |
825 | 825 | /** |
826 | 826 | * @deprecated |
827 | 827 | * @since 4.4.0 |
828 | 828 | */ |
829 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
830 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
831 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
829 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
830 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
831 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
832 | 832 | } |
833 | 833 | /** |
834 | 834 | * @deprecated |
835 | 835 | * @since 4.4.0 |
836 | 836 | */ |
837 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
838 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
839 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
837 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
838 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
839 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
840 | 840 | } |
841 | 841 | /** |
842 | 842 | * @deprecated |
843 | 843 | * @since 4.4.0 |
844 | 844 | */ |
845 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
846 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
847 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
845 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
846 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
847 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
848 | 848 | } |
849 | 849 | /** |
850 | 850 | * @deprecated |
851 | 851 | * @since 4.4.0 |
852 | 852 | */ |
853 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
854 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
855 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
853 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
854 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
855 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
856 | 856 | } |
857 | 857 | /** |
858 | 858 | * @deprecated |
859 | 859 | * @since 4.4.0 |
860 | 860 | */ |
861 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
862 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
863 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
861 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
862 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
863 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
864 | 864 | } |
865 | 865 | /** |
866 | 866 | * @deprecated |
867 | 867 | * @since 4.4.0 |
868 | 868 | */ |
869 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
870 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
871 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
869 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
870 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
871 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | * @param string $extra_class |
900 | 900 | * @return string |
901 | 901 | */ |
902 | -function espresso_event_list_css( $extra_class = '' ) { |
|
903 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
902 | +function espresso_event_list_css($extra_class = '') { |
|
903 | + return EED_Events_Archive::event_list_css($extra_class); |
|
904 | 904 | } |
905 | 905 | |
906 | 906 | /** |
@@ -914,14 +914,14 @@ discard block |
||
914 | 914 | * @return bool |
915 | 915 | */ |
916 | 916 | function espresso_display_full_description_in_event_list() { |
917 | - return EED_Events_Archive::display_description( 2 ); |
|
917 | + return EED_Events_Archive::display_description(2); |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | /** |
921 | 921 | * @return bool |
922 | 922 | */ |
923 | 923 | function espresso_display_excerpt_in_event_list() { |
924 | - return EED_Events_Archive::display_description( 1 ); |
|
924 | + return EED_Events_Archive::display_description(1); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | /** |
@@ -855,11 +855,11 @@ discard block |
||
855 | 855 | if ( ! empty( $id ) ) { |
856 | 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' ) |
|
859 | - . '</a> '; |
|
858 | + . esc_html__( 'Shortcode', 'event_espresso' ) |
|
859 | + . '</a> '; |
|
860 | 860 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
861 | - . $post->ID |
|
862 | - . ']">'; |
|
861 | + . $post->ID |
|
862 | + . ']">'; |
|
863 | 863 | } |
864 | 864 | return $return; |
865 | 865 | } |
@@ -882,10 +882,10 @@ discard block |
||
882 | 882 | esc_html__("View Event Archive Page", "event_espresso"), |
883 | 883 | 'button' |
884 | 884 | ); |
885 | - $this->_template_args['after_list_table'] .= apply_filters( |
|
886 | - 'FHEE__Events_Admin_Page___events_overview_list_table__after_list_table__before_legend', |
|
887 | - '' |
|
888 | - ); |
|
885 | + $this->_template_args['after_list_table'] .= apply_filters( |
|
886 | + 'FHEE__Events_Admin_Page___events_overview_list_table__after_list_table__before_legend', |
|
887 | + '' |
|
888 | + ); |
|
889 | 889 | $this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() ); |
890 | 890 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
891 | 891 | 'create_new', |
@@ -1085,8 +1085,8 @@ discard block |
||
1085 | 1085 | //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. |
1086 | 1086 | if ( ! empty( $dtt['DTT_ID'] ) ) { |
1087 | 1087 | $DTM = EE_Registry::instance() |
1088 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1089 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1088 | + ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1089 | + ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1090 | 1090 | $DTM->set_date_format( $incoming_date_formats[0] ); |
1091 | 1091 | $DTM->set_time_format( $incoming_date_formats[1] ); |
1092 | 1092 | foreach ( $datetime_values as $field => $value ) { |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | ) > 0 ? true : false; |
1185 | 1185 | //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. |
1186 | 1186 | $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
1187 | - && ! $TKT->get( |
|
1187 | + && ! $TKT->get( |
|
1188 | 1188 | 'TKT_deleted' |
1189 | 1189 | ) ? true : false; |
1190 | 1190 | $TKT->set_date_format( $incoming_date_formats[0] ); |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | $first_datetime = reset( $times ); |
1495 | 1495 | //do we get related tickets? |
1496 | 1496 | if ( $first_datetime instanceof EE_Datetime |
1497 | - && $first_datetime->ID() !== 0 |
|
1497 | + && $first_datetime->ID() !== 0 |
|
1498 | 1498 | ) { |
1499 | 1499 | $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
1500 | 1500 | $template_args['time'] = $first_datetime; |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1570 | 1570 | 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
1571 | 1571 | 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
1572 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1572 | + && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1573 | 1573 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1574 | 1574 | 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
1575 | 1575 | : ' disabled=disabled', |
@@ -1735,8 +1735,8 @@ discard block |
||
1735 | 1735 | $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
1736 | 1736 | $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
1737 | 1737 | $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
1738 | - ->setTime( 23, 59, 59 ) |
|
1739 | - ->format( implode( ' ', $start_formats ) ); |
|
1738 | + ->setTime( 23, 59, 59 ) |
|
1739 | + ->format( implode( ' ', $start_formats ) ); |
|
1740 | 1740 | $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
1741 | 1741 | } |
1742 | 1742 | if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | } |
1757 | 1757 | if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
1758 | 1758 | if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
1759 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1759 | + && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1760 | 1760 | ) { |
1761 | 1761 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1762 | 1762 | } |
@@ -2253,13 +2253,13 @@ discard block |
||
2253 | 2253 | protected function _template_settings() { |
2254 | 2254 | $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
2255 | 2255 | $this->_template_args['preview_img'] = '<img src="' |
2256 | - . EVENTS_ASSETS_URL |
|
2257 | - . DS |
|
2258 | - . 'images' |
|
2259 | - . DS |
|
2260 | - . 'caffeinated_template_features.jpg" alt="' |
|
2261 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2262 | - . '" />'; |
|
2256 | + . EVENTS_ASSETS_URL |
|
2257 | + . DS |
|
2258 | + . 'images' |
|
2259 | + . DS |
|
2260 | + . 'caffeinated_template_features.jpg" alt="' |
|
2261 | + . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2262 | + . '" />'; |
|
2263 | 2263 | $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
2264 | 2264 | '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.', |
2265 | 2265 | 'event_espresso' |
@@ -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 |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * @throws \EE_Error |
876 | 876 | */ |
877 | 877 | protected function _events_overview_list_table() { |
878 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
878 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
879 | 879 | $this->_template_args['after_list_table'] = '<br />'; |
880 | 880 | $this->_template_args['after_list_table'] .= EEH_Template::get_button_or_link( |
881 | 881 | get_post_type_archive_link('espresso_events'), |
@@ -886,8 +886,8 @@ discard block |
||
886 | 886 | 'FHEE__Events_Admin_Page___events_overview_list_table__after_list_table__before_legend', |
887 | 887 | '' |
888 | 888 | ); |
889 | - $this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() ); |
|
890 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
889 | + $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
890 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
891 | 891 | 'create_new', |
892 | 892 | 'add', |
893 | 893 | array(), |
@@ -921,48 +921,48 @@ discard block |
||
921 | 921 | * @param object $post The post object of the cpt that was saved. |
922 | 922 | * @return void |
923 | 923 | */ |
924 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
925 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
924 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
925 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
926 | 926 | //get out we're not processing an event save. |
927 | 927 | return; |
928 | 928 | } |
929 | 929 | $event_values = array( |
930 | - 'EVT_display_desc' => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
931 | - 'EVT_display_ticket_selector' => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
930 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
931 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
932 | 932 | 'EVT_additional_limit' => min( |
933 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
934 | - ! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null |
|
933 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
934 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null |
|
935 | 935 | ), |
936 | - 'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] ) |
|
936 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) |
|
937 | 937 | ? $this->_req_data['EVT_default_registration_status'] |
938 | 938 | : EE_Registry::instance()->CFG->registration->default_STS_ID, |
939 | - 'EVT_member_only' => ! empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
940 | - 'EVT_allow_overflow' => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
941 | - 'EVT_timezone_string' => ! empty( $this->_req_data['timezone_string'] ) |
|
939 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
940 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
941 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) |
|
942 | 942 | ? $this->_req_data['timezone_string'] : null, |
943 | - 'EVT_external_URL' => ! empty( $this->_req_data['externalURL'] ) |
|
943 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) |
|
944 | 944 | ? $this->_req_data['externalURL'] : null, |
945 | - 'EVT_phone' => ! empty( $this->_req_data['event_phone'] ) |
|
945 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) |
|
946 | 946 | ? $this->_req_data['event_phone'] : null, |
947 | 947 | ); |
948 | 948 | //update event |
949 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
949 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
950 | 950 | //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! |
951 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
952 | - $event = $this->_event_model()->get_one( array( $get_one_where ) ); |
|
951 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
952 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
953 | 953 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
954 | 954 | $event_update_callbacks = apply_filters( |
955 | 955 | 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
956 | - array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) ) |
|
956 | + array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')) |
|
957 | 957 | ); |
958 | 958 | $att_success = true; |
959 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
960 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
959 | + foreach ($event_update_callbacks as $e_callback) { |
|
960 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
961 | 961 | $att_success = ! $att_success ? $att_success |
962 | 962 | : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
963 | 963 | } |
964 | 964 | //any errors? |
965 | - if ( $success && false === $att_success ) { |
|
965 | + if ($success && false === $att_success) { |
|
966 | 966 | EE_Error::add_error( |
967 | 967 | esc_html__( |
968 | 968 | 'Event Details saved successfully but something went wrong with saving attachments.', |
@@ -972,9 +972,9 @@ discard block |
||
972 | 972 | __FUNCTION__, |
973 | 973 | __LINE__ |
974 | 974 | ); |
975 | - } else if ( $success === false ) { |
|
975 | + } else if ($success === false) { |
|
976 | 976 | EE_Error::add_error( |
977 | - esc_html__( 'Event Details did not save successfully.', 'event_espresso' ), |
|
977 | + esc_html__('Event Details did not save successfully.', 'event_espresso'), |
|
978 | 978 | __FILE__, |
979 | 979 | __FUNCTION__, |
980 | 980 | __LINE__ |
@@ -989,14 +989,14 @@ discard block |
||
989 | 989 | * @param int $post_id |
990 | 990 | * @param int $revision_id |
991 | 991 | */ |
992 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
992 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
993 | 993 | //copy existing event meta to new post |
994 | - $post_evt = $this->_event_model()->get_one_by_ID( $post_id ); |
|
995 | - if ( $post_evt instanceof EE_Event ) { |
|
994 | + $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
|
995 | + if ($post_evt instanceof EE_Event) { |
|
996 | 996 | //meta revision restore |
997 | - $post_evt->restore_revision( $revision_id ); |
|
997 | + $post_evt->restore_revision($revision_id); |
|
998 | 998 | //related objs restore |
999 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
999 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
1000 | 1000 | } |
1001 | 1001 | } |
1002 | 1002 | |
@@ -1009,49 +1009,49 @@ discard block |
||
1009 | 1009 | * @param array $data The request data from the form |
1010 | 1010 | * @return bool Success or fail. |
1011 | 1011 | */ |
1012 | - protected function _default_venue_update( \EE_Event $evtobj, $data ) { |
|
1013 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
1014 | - $venue_model = EE_Registry::instance()->load_model( 'Venue' ); |
|
1012 | + protected function _default_venue_update(\EE_Event $evtobj, $data) { |
|
1013 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
1014 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
1015 | 1015 | $rows_affected = null; |
1016 | - $venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null; |
|
1016 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
1017 | 1017 | // very important. If we don't have a venue name... |
1018 | 1018 | // then we'll get out because not necessary to create empty venue |
1019 | - if ( empty( $data['venue_title'] ) ) { |
|
1019 | + if (empty($data['venue_title'])) { |
|
1020 | 1020 | return false; |
1021 | 1021 | } |
1022 | 1022 | $venue_array = array( |
1023 | - 'VNU_wp_user' => $evtobj->get( 'EVT_wp_user' ), |
|
1024 | - 'VNU_name' => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null, |
|
1025 | - 'VNU_desc' => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null, |
|
1026 | - 'VNU_identifier' => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null, |
|
1027 | - 'VNU_short_desc' => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description'] |
|
1023 | + 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
|
1024 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : null, |
|
1025 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : null, |
|
1026 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null, |
|
1027 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] |
|
1028 | 1028 | : null, |
1029 | - 'VNU_address' => ! empty( $data['address'] ) ? $data['address'] : null, |
|
1030 | - 'VNU_address2' => ! empty( $data['address2'] ) ? $data['address2'] : null, |
|
1031 | - 'VNU_city' => ! empty( $data['city'] ) ? $data['city'] : null, |
|
1032 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : null, |
|
1033 | - 'CNT_ISO' => ! empty( $data['countries'] ) ? $data['countries'] : null, |
|
1034 | - 'VNU_zip' => ! empty( $data['zip'] ) ? $data['zip'] : null, |
|
1035 | - 'VNU_phone' => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null, |
|
1036 | - 'VNU_capacity' => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null, |
|
1037 | - 'VNU_url' => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null, |
|
1038 | - 'VNU_virtual_phone' => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null, |
|
1039 | - 'VNU_virtual_url' => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null, |
|
1040 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
1029 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : null, |
|
1030 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : null, |
|
1031 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : null, |
|
1032 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : null, |
|
1033 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : null, |
|
1034 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : null, |
|
1035 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : null, |
|
1036 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null, |
|
1037 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : null, |
|
1038 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null, |
|
1039 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : null, |
|
1040 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
1041 | 1041 | 'status' => 'publish', |
1042 | 1042 | ); |
1043 | 1043 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
1044 | - if ( ! empty( $venue_id ) ) { |
|
1045 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
1046 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
1044 | + if ( ! empty($venue_id)) { |
|
1045 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
1046 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
1047 | 1047 | //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. |
1048 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1048 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1049 | 1049 | return $rows_affected > 0 ? true : false; |
1050 | 1050 | } else { |
1051 | 1051 | //we insert the venue |
1052 | - $venue_id = $venue_model->insert( $venue_array ); |
|
1053 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1054 | - return ! empty( $venue_id ) ? true : false; |
|
1052 | + $venue_id = $venue_model->insert($venue_array); |
|
1053 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1054 | + return ! empty($venue_id) ? true : false; |
|
1055 | 1055 | } |
1056 | 1056 | //when we have the ancestor come in it's already been handled by the revision save. |
1057 | 1057 | } |
@@ -1065,51 +1065,51 @@ discard block |
||
1065 | 1065 | * @param array $data The request data from the form |
1066 | 1066 | * @return array |
1067 | 1067 | */ |
1068 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
1068 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
1069 | 1069 | $success = true; |
1070 | 1070 | $saved_dtt = null; |
1071 | 1071 | $saved_tickets = array(); |
1072 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1073 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
1072 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1073 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
1074 | 1074 | //trim all values to ensure any excess whitespace is removed. |
1075 | - $dtt = array_map( 'trim', $dtt ); |
|
1076 | - $dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] |
|
1075 | + $dtt = array_map('trim', $dtt); |
|
1076 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] |
|
1077 | 1077 | : $dtt['DTT_EVT_start']; |
1078 | 1078 | $datetime_values = array( |
1079 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null, |
|
1079 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
1080 | 1080 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
1081 | 1081 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
1082 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1082 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1083 | 1083 | 'DTT_order' => $row, |
1084 | 1084 | ); |
1085 | 1085 | //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. |
1086 | - if ( ! empty( $dtt['DTT_ID'] ) ) { |
|
1086 | + if ( ! empty($dtt['DTT_ID'])) { |
|
1087 | 1087 | $DTM = EE_Registry::instance() |
1088 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1089 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1090 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1091 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1092 | - foreach ( $datetime_values as $field => $value ) { |
|
1093 | - $DTM->set( $field, $value ); |
|
1088 | + ->load_model('Datetime', array($evtobj->get_timezone())) |
|
1089 | + ->get_one_by_ID($dtt['DTT_ID']); |
|
1090 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1091 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1092 | + foreach ($datetime_values as $field => $value) { |
|
1093 | + $DTM->set($field, $value); |
|
1094 | 1094 | } |
1095 | 1095 | //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. |
1096 | - $saved_dtts[ $DTM->ID() ] = $DTM; |
|
1096 | + $saved_dtts[$DTM->ID()] = $DTM; |
|
1097 | 1097 | } else { |
1098 | - $DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false ); |
|
1099 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1100 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1101 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
1102 | - foreach ( $datetime_values as $field => $value ) { |
|
1103 | - $DTM->set( $field, $value ); |
|
1098 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false); |
|
1099 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1100 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1101 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
1102 | + foreach ($datetime_values as $field => $value) { |
|
1103 | + $DTM->set($field, $value); |
|
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | $DTM->save(); |
1107 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
1107 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
1108 | 1108 | //load DTT helper |
1109 | 1109 | //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. |
1110 | - if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) { |
|
1111 | - $DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) ); |
|
1112 | - $DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' ); |
|
1110 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
1111 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
1112 | + $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
|
1113 | 1113 | $DTT->save(); |
1114 | 1114 | } |
1115 | 1115 | //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. |
@@ -1120,20 +1120,20 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | //no dtts get deleted so we don't do any of that logic here. |
1122 | 1122 | //update tickets next |
1123 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array(); |
|
1124 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1125 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1123 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1124 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1125 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1126 | 1126 | $update_prices = false; |
1127 | - $ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] ) |
|
1128 | - ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0; |
|
1127 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) |
|
1128 | + ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1129 | 1129 | // trim inputs to ensure any excess whitespace is removed. |
1130 | - $tkt = array_map( 'trim', $tkt ); |
|
1131 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1130 | + $tkt = array_map('trim', $tkt); |
|
1131 | + if (empty($tkt['TKT_start_date'])) { |
|
1132 | 1132 | //let's use now in the set timezone. |
1133 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1134 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1133 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1134 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1135 | 1135 | } |
1136 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1136 | + if (empty($tkt['TKT_end_date'])) { |
|
1137 | 1137 | //use the start date of the first datetime |
1138 | 1138 | $dtt = $evtobj->first_datetime(); |
1139 | 1139 | $tkt['TKT_end_date'] = $dtt->start_date_and_time( |
@@ -1142,22 +1142,22 @@ discard block |
||
1142 | 1142 | ); |
1143 | 1143 | } |
1144 | 1144 | $TKT_values = array( |
1145 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null, |
|
1146 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1147 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1148 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1145 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
1146 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1147 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1148 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1149 | 1149 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1150 | 1150 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1151 | - 'TKT_qty' => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1152 | - 'TKT_uses' => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1153 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1154 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1151 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1152 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1153 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1154 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1155 | 1155 | 'TKT_row' => $row, |
1156 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1156 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1157 | 1157 | 'TKT_price' => $ticket_price, |
1158 | 1158 | ); |
1159 | 1159 | //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. |
1160 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1160 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1161 | 1161 | $TKT_values['TKT_ID'] = 0; |
1162 | 1162 | $TKT_values['TKT_is_default'] = 0; |
1163 | 1163 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1166,110 +1166,110 @@ discard block |
||
1166 | 1166 | //if we have a TKT_ID then we need to get that existing TKT_obj and update it |
1167 | 1167 | //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. |
1168 | 1168 | //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. |
1169 | - if ( ! empty( $tkt['TKT_ID'] ) ) { |
|
1169 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1170 | 1170 | $TKT = EE_Registry::instance() |
1171 | - ->load_model( 'Ticket', array( $evtobj->get_timezone() ) ) |
|
1172 | - ->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1173 | - if ( $TKT instanceof EE_Ticket ) { |
|
1171 | + ->load_model('Ticket', array($evtobj->get_timezone())) |
|
1172 | + ->get_one_by_ID($tkt['TKT_ID']); |
|
1173 | + if ($TKT instanceof EE_Ticket) { |
|
1174 | 1174 | $ticket_sold = $TKT->count_related( |
1175 | 1175 | 'Registration', |
1176 | 1176 | array( |
1177 | 1177 | array( |
1178 | 1178 | 'STS_ID' => array( |
1179 | 1179 | 'NOT IN', |
1180 | - array( EEM_Registration::status_id_incomplete ), |
|
1180 | + array(EEM_Registration::status_id_incomplete), |
|
1181 | 1181 | ), |
1182 | 1182 | ), |
1183 | 1183 | ) |
1184 | 1184 | ) > 0 ? true : false; |
1185 | 1185 | //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. |
1186 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
|
1186 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') |
|
1187 | 1187 | && ! $TKT->get( |
1188 | 1188 | 'TKT_deleted' |
1189 | 1189 | ) ? true : false; |
1190 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1191 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1190 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1191 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1192 | 1192 | //set new values |
1193 | - foreach ( $TKT_values as $field => $value ) { |
|
1194 | - if ( $field == 'TKT_qty' ) { |
|
1195 | - $TKT->set_qty( $value ); |
|
1193 | + foreach ($TKT_values as $field => $value) { |
|
1194 | + if ($field == 'TKT_qty') { |
|
1195 | + $TKT->set_qty($value); |
|
1196 | 1196 | } else { |
1197 | - $TKT->set( $field, $value ); |
|
1197 | + $TKT->set($field, $value); |
|
1198 | 1198 | } |
1199 | 1199 | } |
1200 | 1200 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1201 | - if ( $create_new_TKT ) { |
|
1201 | + if ($create_new_TKT) { |
|
1202 | 1202 | //archive the old ticket first |
1203 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1203 | + $TKT->set('TKT_deleted', 1); |
|
1204 | 1204 | $TKT->save(); |
1205 | 1205 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1206 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1206 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1207 | 1207 | //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. |
1208 | 1208 | $TKT = clone $TKT; |
1209 | - $TKT->set( 'TKT_ID', 0 ); |
|
1210 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1211 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1212 | - $TKT->set( 'TKT_sold', 0 ); |
|
1209 | + $TKT->set('TKT_ID', 0); |
|
1210 | + $TKT->set('TKT_deleted', 0); |
|
1211 | + $TKT->set('TKT_price', $ticket_price); |
|
1212 | + $TKT->set('TKT_sold', 0); |
|
1213 | 1213 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1214 | 1214 | $update_prices = true; |
1215 | 1215 | } |
1216 | 1216 | //make sure price is set if it hasn't been already |
1217 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1217 | + $TKT->set('TKT_price', $ticket_price); |
|
1218 | 1218 | } |
1219 | 1219 | } else { |
1220 | 1220 | //no TKT_id so a new TKT |
1221 | 1221 | $TKT_values['TKT_price'] = $ticket_price; |
1222 | - $TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false ); |
|
1223 | - if ( $TKT instanceof EE_Ticket ) { |
|
1222 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false); |
|
1223 | + if ($TKT instanceof EE_Ticket) { |
|
1224 | 1224 | //need to reset values to properly account for the date formats |
1225 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1226 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1227 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1225 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1226 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1227 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1228 | 1228 | //set new values |
1229 | - foreach ( $TKT_values as $field => $value ) { |
|
1230 | - if ( $field == 'TKT_qty' ) { |
|
1231 | - $TKT->set_qty( $value ); |
|
1229 | + foreach ($TKT_values as $field => $value) { |
|
1230 | + if ($field == 'TKT_qty') { |
|
1231 | + $TKT->set_qty($value); |
|
1232 | 1232 | } else { |
1233 | - $TKT->set( $field, $value ); |
|
1233 | + $TKT->set($field, $value); |
|
1234 | 1234 | } |
1235 | 1235 | } |
1236 | 1236 | $update_prices = true; |
1237 | 1237 | } |
1238 | 1238 | } |
1239 | 1239 | // cap ticket qty by datetime reg limits |
1240 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1240 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1241 | 1241 | //update ticket. |
1242 | 1242 | $TKT->save(); |
1243 | 1243 | //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. |
1244 | - if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) { |
|
1245 | - $TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) ); |
|
1246 | - $TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' ); |
|
1244 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1245 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1246 | + $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
1247 | 1247 | $TKT->save(); |
1248 | 1248 | } |
1249 | 1249 | //initially let's add the ticket to the dtt |
1250 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1251 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1250 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1251 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1252 | 1252 | //add prices to ticket |
1253 | - $this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices ); |
|
1253 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1254 | 1254 | } |
1255 | 1255 | //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. |
1256 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1257 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1258 | - foreach ( $tickets_removed as $id ) { |
|
1259 | - $id = absint( $id ); |
|
1256 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1257 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1258 | + foreach ($tickets_removed as $id) { |
|
1259 | + $id = absint($id); |
|
1260 | 1260 | //get the ticket for this id |
1261 | - $tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id ); |
|
1261 | + $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
1262 | 1262 | //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) |
1263 | - $dtts = $tkt_to_remove->get_many_related( 'Datetime' ); |
|
1264 | - foreach ( $dtts as $dtt ) { |
|
1265 | - $tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' ); |
|
1263 | + $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
1264 | + foreach ($dtts as $dtt) { |
|
1265 | + $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
1266 | 1266 | } |
1267 | 1267 | //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)) |
1268 | - $tkt_to_remove->delete_related_permanently( 'Price' ); |
|
1268 | + $tkt_to_remove->delete_related_permanently('Price'); |
|
1269 | 1269 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1270 | 1270 | $tkt_to_remove->delete_permanently(); |
1271 | 1271 | } |
1272 | - return array( $saved_dtt, $saved_tickets ); |
|
1272 | + return array($saved_dtt, $saved_tickets); |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | |
@@ -1286,29 +1286,29 @@ discard block |
||
1286 | 1286 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1287 | 1287 | * @return void |
1288 | 1288 | */ |
1289 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) { |
|
1290 | - foreach ( $prices as $row => $prc ) { |
|
1289 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) { |
|
1290 | + foreach ($prices as $row => $prc) { |
|
1291 | 1291 | $PRC_values = array( |
1292 | - 'PRC_ID' => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null, |
|
1293 | - 'PRT_ID' => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null, |
|
1294 | - 'PRC_amount' => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1295 | - 'PRC_name' => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1296 | - 'PRC_desc' => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1292 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
1293 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null, |
|
1294 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1295 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1296 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1297 | 1297 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1298 | 1298 | 'PRC_order' => $row, |
1299 | 1299 | ); |
1300 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1300 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1301 | 1301 | $PRC_values['PRC_ID'] = 0; |
1302 | - $PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false ); |
|
1302 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
1303 | 1303 | } else { |
1304 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1304 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1305 | 1305 | //update this price with new values |
1306 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1307 | - $PRC->set( $field, $newprc ); |
|
1306 | + foreach ($PRC_values as $field => $newprc) { |
|
1307 | + $PRC->set($field, $newprc); |
|
1308 | 1308 | } |
1309 | 1309 | $PRC->save(); |
1310 | 1310 | } |
1311 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1311 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1312 | 1312 | } |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | private function _generate_publish_box_extra_content() { |
1341 | 1341 | //load formatter helper |
1342 | 1342 | //args for getting related registrations |
1343 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1343 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1344 | 1344 | $not_approved_query_args = array( |
1345 | 1345 | array( |
1346 | 1346 | 'REG_deleted' => 0, |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
1412 | 1412 | // load template |
1413 | 1413 | EEH_Template::display_template( |
1414 | - EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', |
|
1414 | + EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', |
|
1415 | 1415 | $publish_box_extra_args |
1416 | 1416 | ); |
1417 | 1417 | } |
@@ -1445,16 +1445,16 @@ discard block |
||
1445 | 1445 | $this->verify_cpt_object(); |
1446 | 1446 | add_meta_box( |
1447 | 1447 | 'espresso_event_editor_tickets', |
1448 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1449 | - array( $this, 'ticket_metabox' ), |
|
1448 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1449 | + array($this, 'ticket_metabox'), |
|
1450 | 1450 | $this->page_slug, |
1451 | 1451 | 'normal', |
1452 | 1452 | 'high' |
1453 | 1453 | ); |
1454 | 1454 | add_meta_box( |
1455 | 1455 | 'espresso_event_editor_event_options', |
1456 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1457 | - array( $this, 'registration_options_meta_box' ), |
|
1456 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1457 | + array($this, 'registration_options_meta_box'), |
|
1458 | 1458 | $this->page_slug, |
1459 | 1459 | 'side', |
1460 | 1460 | 'default' |
@@ -1482,65 +1482,65 @@ discard block |
||
1482 | 1482 | 'trash_icon' => 'ee-lock-icon', |
1483 | 1483 | 'disabled' => '', |
1484 | 1484 | ); |
1485 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null; |
|
1486 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1485 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null; |
|
1486 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1487 | 1487 | /** |
1488 | 1488 | * 1. Start with retrieving Datetimes |
1489 | 1489 | * 2. Fore each datetime get related tickets |
1490 | 1490 | * 3. For each ticket get related prices |
1491 | 1491 | */ |
1492 | - $times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id ); |
|
1492 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1493 | 1493 | /** @type EE_Datetime $first_datetime */ |
1494 | - $first_datetime = reset( $times ); |
|
1494 | + $first_datetime = reset($times); |
|
1495 | 1495 | //do we get related tickets? |
1496 | - if ( $first_datetime instanceof EE_Datetime |
|
1496 | + if ($first_datetime instanceof EE_Datetime |
|
1497 | 1497 | && $first_datetime->ID() !== 0 |
1498 | 1498 | ) { |
1499 | - $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
|
1499 | + $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
|
1500 | 1500 | $template_args['time'] = $first_datetime; |
1501 | 1501 | $related_tickets = $first_datetime->tickets( |
1502 | 1502 | array( |
1503 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1503 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1504 | 1504 | 'default_where_conditions' => 'none', |
1505 | 1505 | ) |
1506 | 1506 | ); |
1507 | - if ( ! empty( $related_tickets ) ) { |
|
1508 | - $template_args['total_ticket_rows'] = count( $related_tickets ); |
|
1507 | + if ( ! empty($related_tickets)) { |
|
1508 | + $template_args['total_ticket_rows'] = count($related_tickets); |
|
1509 | 1509 | $row = 0; |
1510 | - foreach ( $related_tickets as $ticket ) { |
|
1511 | - $existing_ticket_ids[] = $ticket->get( 'TKT_ID' ); |
|
1512 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row ); |
|
1510 | + foreach ($related_tickets as $ticket) { |
|
1511 | + $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
|
1512 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row); |
|
1513 | 1513 | $row++; |
1514 | 1514 | } |
1515 | 1515 | } else { |
1516 | 1516 | $template_args['total_ticket_rows'] = 1; |
1517 | 1517 | /** @type EE_Ticket $ticket */ |
1518 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(); |
|
1519 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1518 | + $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
|
1519 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1520 | 1520 | } |
1521 | 1521 | } else { |
1522 | 1522 | $template_args['time'] = $times[0]; |
1523 | 1523 | /** @type EE_Ticket $ticket */ |
1524 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets(); |
|
1525 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1524 | + $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
1525 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1526 | 1526 | // NOTE: we're just sending the first default row |
1527 | 1527 | // (decaf can't manage default tickets so this should be sufficient); |
1528 | 1528 | } |
1529 | 1529 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link( |
1530 | 1530 | 'event_editor_event_datetimes_help_tab' |
1531 | 1531 | ); |
1532 | - $template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' ); |
|
1533 | - $template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
1534 | - $template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
1532 | + $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
|
1533 | + $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
1534 | + $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
1535 | 1535 | $template_args['ticket_js_structure'] = $this->_get_ticket_row( |
1536 | - EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(), |
|
1536 | + EE_Registry::instance()->load_model('Ticket')->create_default_object(), |
|
1537 | 1537 | true |
1538 | 1538 | ); |
1539 | 1539 | $template = apply_filters( |
1540 | 1540 | 'FHEE__Events_Admin_Page__ticket_metabox__template', |
1541 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' |
|
1541 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php' |
|
1542 | 1542 | ); |
1543 | - EEH_Template::display_template( $template, $template_args ); |
|
1543 | + EEH_Template::display_template($template, $template_args); |
|
1544 | 1544 | } |
1545 | 1545 | |
1546 | 1546 | |
@@ -1554,74 +1554,74 @@ discard block |
||
1554 | 1554 | * @param int $row |
1555 | 1555 | * @return string generated html for the ticket row. |
1556 | 1556 | */ |
1557 | - private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) { |
|
1557 | + private function _get_ticket_row($ticket, $skeleton = false, $row = 0) { |
|
1558 | 1558 | $template_args = array( |
1559 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1559 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1560 | 1560 | 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' |
1561 | 1561 | : '', |
1562 | 1562 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1563 | - 'TKT_ID' => $ticket->get( 'TKT_ID' ), |
|
1564 | - 'TKT_name' => $ticket->get( 'TKT_name' ), |
|
1565 | - 'TKT_start_date' => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ), |
|
1566 | - 'TKT_end_date' => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ), |
|
1567 | - 'TKT_is_default' => $ticket->get( 'TKT_is_default' ), |
|
1568 | - 'TKT_qty' => $ticket->get_pretty( 'TKT_qty', 'input' ), |
|
1563 | + 'TKT_ID' => $ticket->get('TKT_ID'), |
|
1564 | + 'TKT_name' => $ticket->get('TKT_name'), |
|
1565 | + 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
|
1566 | + 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
|
1567 | + 'TKT_is_default' => $ticket->get('TKT_is_default'), |
|
1568 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1569 | 1569 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1570 | - 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
|
1571 | - 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
|
1572 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1570 | + 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
|
1571 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) |
|
1572 | + && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) |
|
1573 | 1573 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1574 | - 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
|
1574 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' |
|
1575 | 1575 | : ' disabled=disabled', |
1576 | 1576 | ); |
1577 | 1577 | $price = $ticket->ID() !== 0 |
1578 | - ? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) ) |
|
1579 | - : EE_Registry::instance()->load_model( 'Price' )->create_default_object(); |
|
1578 | + ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) |
|
1579 | + : EE_Registry::instance()->load_model('Price')->create_default_object(); |
|
1580 | 1580 | $price_args = array( |
1581 | 1581 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1582 | - 'PRC_amount' => $price->get( 'PRC_amount' ), |
|
1583 | - 'PRT_ID' => $price->get( 'PRT_ID' ), |
|
1584 | - 'PRC_ID' => $price->get( 'PRC_ID' ), |
|
1585 | - 'PRC_is_default' => $price->get( 'PRC_is_default' ), |
|
1582 | + 'PRC_amount' => $price->get('PRC_amount'), |
|
1583 | + 'PRT_ID' => $price->get('PRT_ID'), |
|
1584 | + 'PRC_ID' => $price->get('PRC_ID'), |
|
1585 | + 'PRC_is_default' => $price->get('PRC_is_default'), |
|
1586 | 1586 | ); |
1587 | 1587 | //make sure we have default start and end dates if skeleton |
1588 | 1588 | //handle rows that should NOT be empty |
1589 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1589 | + if (empty($template_args['TKT_start_date'])) { |
|
1590 | 1590 | //if empty then the start date will be now. |
1591 | - $template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) ); |
|
1591 | + $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
|
1592 | 1592 | } |
1593 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1593 | + if (empty($template_args['TKT_end_date'])) { |
|
1594 | 1594 | //get the earliest datetime (if present); |
1595 | 1595 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 |
1596 | 1596 | ? $this->_cpt_model_obj->get_first_related( |
1597 | 1597 | 'Datetime', |
1598 | - array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) |
|
1598 | + array('order_by' => array('DTT_EVT_start' => 'ASC')) |
|
1599 | 1599 | ) |
1600 | 1600 | : null; |
1601 | - if ( ! empty( $earliest_dtt ) ) { |
|
1602 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' ); |
|
1601 | + if ( ! empty($earliest_dtt)) { |
|
1602 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1603 | 1603 | } else { |
1604 | 1604 | $template_args['TKT_end_date'] = date( |
1605 | 1605 | 'Y-m-d h:i a', |
1606 | - mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) ) |
|
1606 | + mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")) |
|
1607 | 1607 | ); |
1608 | 1608 | } |
1609 | 1609 | } |
1610 | - $template_args = array_merge( $template_args, $price_args ); |
|
1610 | + $template_args = array_merge($template_args, $price_args); |
|
1611 | 1611 | $template = apply_filters( |
1612 | 1612 | 'FHEE__Events_Admin_Page__get_ticket_row__template', |
1613 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', |
|
1613 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', |
|
1614 | 1614 | $ticket |
1615 | 1615 | ); |
1616 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
1616 | + return EEH_Template::display_template($template, $template_args, true); |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | |
1620 | 1620 | |
1621 | 1621 | public function registration_options_meta_box() { |
1622 | 1622 | $yes_no_values = array( |
1623 | - array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ), |
|
1624 | - array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ), |
|
1623 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
1624 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
1625 | 1625 | ); |
1626 | 1626 | $default_reg_status_values = EEM_Registration::reg_status_array( |
1627 | 1627 | array( |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | ); |
1634 | 1634 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1635 | 1635 | $template_args['_event'] = $this->_cpt_model_obj; |
1636 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false ); |
|
1636 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1637 | 1637 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
1638 | 1638 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
1639 | 1639 | 'default_reg_status', |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | $default_reg_status_values |
1662 | 1662 | ); |
1663 | 1663 | EEH_Template::display_template( |
1664 | - EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1664 | + EVENTS_TEMPLATE_PATH.'event_registration_options.template.php', |
|
1665 | 1665 | $template_args |
1666 | 1666 | ); |
1667 | 1667 | } |
@@ -1680,97 +1680,97 @@ discard block |
||
1680 | 1680 | * that match the given _view and paging parameters. |
1681 | 1681 | * @return array an array of event objects. |
1682 | 1682 | */ |
1683 | - public function get_events( $per_page = 10, $current_page = 1, $count = false ) { |
|
1683 | + public function get_events($per_page = 10, $current_page = 1, $count = false) { |
|
1684 | 1684 | $EEME = $this->_event_model(); |
1685 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1686 | - $limit = $count ? null : $offset . ',' . $per_page; |
|
1687 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1688 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC"; |
|
1689 | - if ( isset( $this->_req_data['month_range'] ) ) { |
|
1690 | - $pieces = explode( ' ', $this->_req_data['month_range'], 3 ); |
|
1691 | - $month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : ''; |
|
1692 | - $year_r = ! empty( $pieces[1] ) ? $pieces[1] : ''; |
|
1685 | + $offset = ($current_page - 1) * $per_page; |
|
1686 | + $limit = $count ? null : $offset.','.$per_page; |
|
1687 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1688 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
|
1689 | + if (isset($this->_req_data['month_range'])) { |
|
1690 | + $pieces = explode(' ', $this->_req_data['month_range'], 3); |
|
1691 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1692 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1693 | 1693 | } |
1694 | 1694 | $where = array(); |
1695 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
1695 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1696 | 1696 | //determine what post_status our condition will have for the query. |
1697 | - switch ( $status ) { |
|
1697 | + switch ($status) { |
|
1698 | 1698 | case 'month' : |
1699 | 1699 | case 'today' : |
1700 | 1700 | case null : |
1701 | 1701 | case 'all' : |
1702 | 1702 | break; |
1703 | 1703 | case 'draft' : |
1704 | - $where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) ); |
|
1704 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1705 | 1705 | break; |
1706 | 1706 | default : |
1707 | 1707 | $where['status'] = $status; |
1708 | 1708 | } |
1709 | 1709 | //categories? |
1710 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 |
|
1710 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1711 | 1711 | ? $this->_req_data['EVT_CAT'] : null; |
1712 | - if ( ! empty ( $category ) ) { |
|
1712 | + if ( ! empty ($category)) { |
|
1713 | 1713 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1714 | 1714 | $where['Term_Taxonomy.term_id'] = $category; |
1715 | 1715 | } |
1716 | 1716 | //date where conditions |
1717 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1718 | - if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) { |
|
1717 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1718 | + if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
|
1719 | 1719 | $DateTime = new DateTime( |
1720 | - $year_r . '-' . $month_r . '-01 00:00:00', |
|
1721 | - new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) |
|
1720 | + $year_r.'-'.$month_r.'-01 00:00:00', |
|
1721 | + new DateTimeZone(EEM_Datetime::instance()->get_timezone()) |
|
1722 | 1722 | ); |
1723 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1724 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format( |
|
1725 | - implode( ' ', $start_formats ) |
|
1723 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1724 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format( |
|
1725 | + implode(' ', $start_formats) |
|
1726 | 1726 | ); |
1727 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1728 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) { |
|
1729 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1730 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1731 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1732 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1733 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) { |
|
1734 | - $now = date( 'Y-m-01' ); |
|
1735 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1736 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1737 | - $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
|
1738 | - ->setTime( 23, 59, 59 ) |
|
1739 | - ->format( implode( ' ', $start_formats ) ); |
|
1740 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1727 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1728 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
|
1729 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1730 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1731 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1732 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1733 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1734 | + $now = date('Y-m-01'); |
|
1735 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1736 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1737 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t')) |
|
1738 | + ->setTime(23, 59, 59) |
|
1739 | + ->format(implode(' ', $start_formats)); |
|
1740 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1741 | 1741 | } |
1742 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1742 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1743 | 1743 | $where['EVT_wp_user'] = get_current_user_id(); |
1744 | 1744 | } else { |
1745 | - if ( ! isset( $where['status'] ) ) { |
|
1746 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1745 | + if ( ! isset($where['status'])) { |
|
1746 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1747 | 1747 | $where['OR'] = array( |
1748 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1748 | + 'status*restrict_private' => array('!=', 'private'), |
|
1749 | 1749 | 'AND' => array( |
1750 | - 'status*inclusive' => array( '=', 'private' ), |
|
1750 | + 'status*inclusive' => array('=', 'private'), |
|
1751 | 1751 | 'EVT_wp_user' => get_current_user_id(), |
1752 | 1752 | ), |
1753 | 1753 | ); |
1754 | 1754 | } |
1755 | 1755 | } |
1756 | 1756 | } |
1757 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1758 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1759 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1757 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1758 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1759 | + && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events') |
|
1760 | 1760 | ) { |
1761 | 1761 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1762 | 1762 | } |
1763 | 1763 | } |
1764 | 1764 | //search query handling |
1765 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1766 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1765 | + if (isset($this->_req_data['s'])) { |
|
1766 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1767 | 1767 | $where['OR'] = array( |
1768 | - 'EVT_name' => array( 'LIKE', $search_string ), |
|
1769 | - 'EVT_desc' => array( 'LIKE', $search_string ), |
|
1770 | - 'EVT_short_desc' => array( 'LIKE', $search_string ), |
|
1768 | + 'EVT_name' => array('LIKE', $search_string), |
|
1769 | + 'EVT_desc' => array('LIKE', $search_string), |
|
1770 | + 'EVT_short_desc' => array('LIKE', $search_string), |
|
1771 | 1771 | ); |
1772 | 1772 | } |
1773 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1773 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1774 | 1774 | $query_params = apply_filters( |
1775 | 1775 | 'FHEE__Events_Admin_Page__get_events__query_params', |
1776 | 1776 | array( |
@@ -1783,23 +1783,23 @@ discard block |
||
1783 | 1783 | $this->_req_data |
1784 | 1784 | ); |
1785 | 1785 | //let's first check if we have special requests coming in. |
1786 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1787 | - switch ( $this->_req_data['active_status'] ) { |
|
1786 | + if (isset($this->_req_data['active_status'])) { |
|
1787 | + switch ($this->_req_data['active_status']) { |
|
1788 | 1788 | case 'upcoming' : |
1789 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1789 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1790 | 1790 | break; |
1791 | 1791 | case 'expired' : |
1792 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1792 | + return $EEME->get_expired_events($query_params, $count); |
|
1793 | 1793 | break; |
1794 | 1794 | case 'active' : |
1795 | - return $EEME->get_active_events( $query_params, $count ); |
|
1795 | + return $EEME->get_active_events($query_params, $count); |
|
1796 | 1796 | break; |
1797 | 1797 | case 'inactive' : |
1798 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1798 | + return $EEME->get_inactive_events($query_params, $count); |
|
1799 | 1799 | break; |
1800 | 1800 | } |
1801 | 1801 | } |
1802 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1802 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1803 | 1803 | return $events; |
1804 | 1804 | } |
1805 | 1805 | |
@@ -1810,9 +1810,9 @@ discard block |
||
1810 | 1810 | * |
1811 | 1811 | * @param string $post_id |
1812 | 1812 | */ |
1813 | - public function trash_cpt_item( $post_id ) { |
|
1813 | + public function trash_cpt_item($post_id) { |
|
1814 | 1814 | $this->_req_data['EVT_ID'] = $post_id; |
1815 | - $this->_trash_or_restore_event( 'trash', false ); |
|
1815 | + $this->_trash_or_restore_event('trash', false); |
|
1816 | 1816 | } |
1817 | 1817 | |
1818 | 1818 | |
@@ -1820,9 +1820,9 @@ discard block |
||
1820 | 1820 | /** |
1821 | 1821 | * @param string $post_id |
1822 | 1822 | */ |
1823 | - public function restore_cpt_item( $post_id ) { |
|
1823 | + public function restore_cpt_item($post_id) { |
|
1824 | 1824 | $this->_req_data['EVT_ID'] = $post_id; |
1825 | - $this->_trash_or_restore_event( 'draft', false ); |
|
1825 | + $this->_trash_or_restore_event('draft', false); |
|
1826 | 1826 | } |
1827 | 1827 | |
1828 | 1828 | |
@@ -1830,9 +1830,9 @@ discard block |
||
1830 | 1830 | /** |
1831 | 1831 | * @param string $post_id |
1832 | 1832 | */ |
1833 | - public function delete_cpt_item( $post_id ) { |
|
1833 | + public function delete_cpt_item($post_id) { |
|
1834 | 1834 | $this->_req_data['EVT_ID'] = $post_id; |
1835 | - $this->_delete_event( false ); |
|
1835 | + $this->_delete_event(false); |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | 1838 | |
@@ -1844,23 +1844,23 @@ discard block |
||
1844 | 1844 | * @param string $event_status |
1845 | 1845 | * @param bool $redirect_after |
1846 | 1846 | */ |
1847 | - protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) { |
|
1847 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) { |
|
1848 | 1848 | //determine the event id and set to array. |
1849 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false; |
|
1849 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false; |
|
1850 | 1850 | // loop thru events |
1851 | - if ( $EVT_ID ) { |
|
1851 | + if ($EVT_ID) { |
|
1852 | 1852 | // clean status |
1853 | - $event_status = sanitize_key( $event_status ); |
|
1853 | + $event_status = sanitize_key($event_status); |
|
1854 | 1854 | // grab status |
1855 | - if ( ! empty( $event_status ) ) { |
|
1856 | - $success = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1855 | + if ( ! empty($event_status)) { |
|
1856 | + $success = $this->_change_event_status($EVT_ID, $event_status); |
|
1857 | 1857 | } else { |
1858 | 1858 | $success = false; |
1859 | 1859 | $msg = esc_html__( |
1860 | 1860 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1861 | 1861 | 'event_espresso' |
1862 | 1862 | ); |
1863 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1863 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1864 | 1864 | } |
1865 | 1865 | } else { |
1866 | 1866 | $success = false; |
@@ -1868,11 +1868,11 @@ discard block |
||
1868 | 1868 | 'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', |
1869 | 1869 | 'event_espresso' |
1870 | 1870 | ); |
1871 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1871 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1872 | 1872 | } |
1873 | 1873 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1874 | - if ( $redirect_after ) { |
|
1875 | - $this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) ); |
|
1874 | + if ($redirect_after) { |
|
1875 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1876 | 1876 | } |
1877 | 1877 | } |
1878 | 1878 | |
@@ -1885,18 +1885,18 @@ discard block |
||
1885 | 1885 | * @param string $event_status |
1886 | 1886 | * @return void |
1887 | 1887 | */ |
1888 | - protected function _trash_or_restore_events( $event_status = 'trash' ) { |
|
1888 | + protected function _trash_or_restore_events($event_status = 'trash') { |
|
1889 | 1889 | // clean status |
1890 | - $event_status = sanitize_key( $event_status ); |
|
1890 | + $event_status = sanitize_key($event_status); |
|
1891 | 1891 | // grab status |
1892 | - if ( ! empty( $event_status ) ) { |
|
1892 | + if ( ! empty($event_status)) { |
|
1893 | 1893 | $success = true; |
1894 | 1894 | //determine the event id and set to array. |
1895 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1895 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1896 | 1896 | // loop thru events |
1897 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
1898 | - if ( $EVT_ID = absint( $EVT_ID ) ) { |
|
1899 | - $results = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1897 | + foreach ($EVT_IDs as $EVT_ID) { |
|
1898 | + if ($EVT_ID = absint($EVT_ID)) { |
|
1899 | + $results = $this->_change_event_status($EVT_ID, $event_status); |
|
1900 | 1900 | $success = $results !== false ? $success : false; |
1901 | 1901 | } else { |
1902 | 1902 | $msg = sprintf( |
@@ -1906,7 +1906,7 @@ discard block |
||
1906 | 1906 | ), |
1907 | 1907 | $EVT_ID |
1908 | 1908 | ); |
1909 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1909 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1910 | 1910 | $success = false; |
1911 | 1911 | } |
1912 | 1912 | } |
@@ -1916,12 +1916,12 @@ discard block |
||
1916 | 1916 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1917 | 1917 | 'event_espresso' |
1918 | 1918 | ); |
1919 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1919 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1920 | 1920 | } |
1921 | 1921 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
1922 | 1922 | $success = $success ? 2 : false; |
1923 | 1923 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1924 | - $this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) ); |
|
1924 | + $this->_redirect_after_action($success, 'Events', $action, array('action' => 'default')); |
|
1925 | 1925 | } |
1926 | 1926 | |
1927 | 1927 | |
@@ -1934,30 +1934,30 @@ discard block |
||
1934 | 1934 | * @param string $event_status |
1935 | 1935 | * @return bool |
1936 | 1936 | */ |
1937 | - private function _change_event_status( $EVT_ID = 0, $event_status = '' ) { |
|
1937 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1938 | 1938 | // grab event id |
1939 | - if ( ! $EVT_ID ) { |
|
1939 | + if ( ! $EVT_ID) { |
|
1940 | 1940 | $msg = esc_html__( |
1941 | 1941 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
1942 | 1942 | 'event_espresso' |
1943 | 1943 | ); |
1944 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1944 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1945 | 1945 | return false; |
1946 | 1946 | } |
1947 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1947 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1948 | 1948 | // clean status |
1949 | - $event_status = sanitize_key( $event_status ); |
|
1949 | + $event_status = sanitize_key($event_status); |
|
1950 | 1950 | // grab status |
1951 | - if ( empty( $event_status ) ) { |
|
1951 | + if (empty($event_status)) { |
|
1952 | 1952 | $msg = esc_html__( |
1953 | 1953 | 'An error occurred. No Event Status or an invalid Event Status was received.', |
1954 | 1954 | 'event_espresso' |
1955 | 1955 | ); |
1956 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1956 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1957 | 1957 | return false; |
1958 | 1958 | } |
1959 | 1959 | // was event trashed or restored ? |
1960 | - switch ( $event_status ) { |
|
1960 | + switch ($event_status) { |
|
1961 | 1961 | case 'draft' : |
1962 | 1962 | $action = 'restored from the trash'; |
1963 | 1963 | $hook = 'AHEE_event_restored_from_trash'; |
@@ -1971,15 +1971,15 @@ discard block |
||
1971 | 1971 | $hook = false; |
1972 | 1972 | } |
1973 | 1973 | //use class to change status |
1974 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1974 | + $this->_cpt_model_obj->set_status($event_status); |
|
1975 | 1975 | $success = $this->_cpt_model_obj->save(); |
1976 | - if ( $success === false ) { |
|
1977 | - $msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action ); |
|
1978 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1976 | + if ($success === false) { |
|
1977 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1978 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1979 | 1979 | return false; |
1980 | 1980 | } |
1981 | - if ( $hook ) { |
|
1982 | - do_action( $hook ); |
|
1981 | + if ($hook) { |
|
1982 | + do_action($hook); |
|
1983 | 1983 | } |
1984 | 1984 | return true; |
1985 | 1985 | } |
@@ -1992,34 +1992,34 @@ discard block |
||
1992 | 1992 | * @access protected |
1993 | 1993 | * @param bool $redirect_after |
1994 | 1994 | */ |
1995 | - protected function _delete_event( $redirect_after = true ) { |
|
1995 | + protected function _delete_event($redirect_after = true) { |
|
1996 | 1996 | //determine the event id and set to array. |
1997 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null; |
|
1998 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1997 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null; |
|
1998 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1999 | 1999 | // loop thru events |
2000 | - if ( $EVT_ID ) { |
|
2001 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
2000 | + if ($EVT_ID) { |
|
2001 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
2002 | 2002 | // get list of events with no prices |
2003 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
2003 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
2004 | 2004 | // remove this event from the list of events with no prices |
2005 | - if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) { |
|
2006 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
2005 | + if (isset($espresso_no_ticket_prices[$EVT_ID])) { |
|
2006 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
2007 | 2007 | } |
2008 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
2008 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
2009 | 2009 | } else { |
2010 | 2010 | $success = false; |
2011 | 2011 | $msg = esc_html__( |
2012 | 2012 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
2013 | 2013 | 'event_espresso' |
2014 | 2014 | ); |
2015 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2015 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2016 | 2016 | } |
2017 | - if ( $redirect_after ) { |
|
2017 | + if ($redirect_after) { |
|
2018 | 2018 | $this->_redirect_after_action( |
2019 | 2019 | $success, |
2020 | 2020 | 'Event', |
2021 | 2021 | 'deleted', |
2022 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
2022 | + array('action' => 'default', 'status' => 'trash') |
|
2023 | 2023 | ); |
2024 | 2024 | } |
2025 | 2025 | } |
@@ -2035,30 +2035,30 @@ discard block |
||
2035 | 2035 | protected function _delete_events() { |
2036 | 2036 | $success = true; |
2037 | 2037 | // get list of events with no prices |
2038 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
2038 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
2039 | 2039 | //determine the event id and set to array. |
2040 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2040 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2041 | 2041 | // loop thru events |
2042 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
2043 | - $EVT_ID = absint( $EVT_ID ); |
|
2044 | - if ( $EVT_ID ) { |
|
2045 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
2042 | + foreach ($EVT_IDs as $EVT_ID) { |
|
2043 | + $EVT_ID = absint($EVT_ID); |
|
2044 | + if ($EVT_ID) { |
|
2045 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
2046 | 2046 | $success = $results !== false ? $success : false; |
2047 | 2047 | // remove this event from the list of events with no prices |
2048 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
2048 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
2049 | 2049 | } else { |
2050 | 2050 | $success = false; |
2051 | 2051 | $msg = esc_html__( |
2052 | 2052 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
2053 | 2053 | 'event_espresso' |
2054 | 2054 | ); |
2055 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2055 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2056 | 2056 | } |
2057 | 2057 | } |
2058 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
2058 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
2059 | 2059 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
2060 | 2060 | $success = $success ? 2 : false; |
2061 | - $this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) ); |
|
2061 | + $this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default')); |
|
2062 | 2062 | } |
2063 | 2063 | |
2064 | 2064 | |
@@ -2070,70 +2070,70 @@ discard block |
||
2070 | 2070 | * @param int $EVT_ID |
2071 | 2071 | * @return bool |
2072 | 2072 | */ |
2073 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
2073 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
2074 | 2074 | // grab event id |
2075 | - if ( ! $EVT_ID ) { |
|
2075 | + if ( ! $EVT_ID) { |
|
2076 | 2076 | $msg = esc_html__( |
2077 | 2077 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
2078 | 2078 | 'event_espresso' |
2079 | 2079 | ); |
2080 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2080 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2081 | 2081 | return false; |
2082 | 2082 | } |
2083 | 2083 | if ( |
2084 | 2084 | ! $this->_cpt_model_obj instanceof EE_Event |
2085 | 2085 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
2086 | 2086 | ) { |
2087 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
2087 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
2088 | 2088 | } |
2089 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
2089 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
2090 | 2090 | return false; |
2091 | 2091 | } |
2092 | 2092 | //need to delete related tickets and prices first. |
2093 | - $datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' ); |
|
2094 | - foreach ( $datetimes as $datetime ) { |
|
2095 | - $this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' ); |
|
2096 | - $tickets = $datetime->get_many_related( 'Ticket' ); |
|
2097 | - foreach ( $tickets as $ticket ) { |
|
2098 | - $ticket->_remove_relation_to( $datetime, 'Datetime' ); |
|
2099 | - $ticket->delete_related_permanently( 'Price' ); |
|
2093 | + $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
|
2094 | + foreach ($datetimes as $datetime) { |
|
2095 | + $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
|
2096 | + $tickets = $datetime->get_many_related('Ticket'); |
|
2097 | + foreach ($tickets as $ticket) { |
|
2098 | + $ticket->_remove_relation_to($datetime, 'Datetime'); |
|
2099 | + $ticket->delete_related_permanently('Price'); |
|
2100 | 2100 | $ticket->delete_permanently(); |
2101 | 2101 | } |
2102 | 2102 | $datetime->delete(); |
2103 | 2103 | } |
2104 | 2104 | //what about related venues or terms? |
2105 | - $venues = $this->_cpt_model_obj->get_many_related( 'Venue' ); |
|
2106 | - foreach ( $venues as $venue ) { |
|
2107 | - $this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' ); |
|
2105 | + $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
|
2106 | + foreach ($venues as $venue) { |
|
2107 | + $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
|
2108 | 2108 | } |
2109 | 2109 | //any attached question groups? |
2110 | - $question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' ); |
|
2111 | - if ( ! empty( $question_groups ) ) { |
|
2112 | - foreach ( $question_groups as $question_group ) { |
|
2113 | - $this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' ); |
|
2110 | + $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
|
2111 | + if ( ! empty($question_groups)) { |
|
2112 | + foreach ($question_groups as $question_group) { |
|
2113 | + $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
|
2114 | 2114 | } |
2115 | 2115 | } |
2116 | 2116 | //Message Template Groups |
2117 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
2117 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
2118 | 2118 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
2119 | 2119 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
2120 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
2121 | - $this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy ); |
|
2120 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
2121 | + $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
|
2122 | 2122 | } |
2123 | 2123 | $success = $this->_cpt_model_obj->delete_permanently(); |
2124 | 2124 | // did it all go as planned ? |
2125 | - if ( $success ) { |
|
2126 | - $msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID ); |
|
2127 | - EE_Error::add_success( $msg ); |
|
2125 | + if ($success) { |
|
2126 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
2127 | + EE_Error::add_success($msg); |
|
2128 | 2128 | } else { |
2129 | 2129 | $msg = sprintf( |
2130 | - esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ), |
|
2130 | + esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), |
|
2131 | 2131 | $EVT_ID |
2132 | 2132 | ); |
2133 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2133 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2134 | 2134 | return false; |
2135 | 2135 | } |
2136 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2136 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2137 | 2137 | return true; |
2138 | 2138 | } |
2139 | 2139 | |
@@ -2146,7 +2146,7 @@ discard block |
||
2146 | 2146 | * @return int |
2147 | 2147 | */ |
2148 | 2148 | public function total_events() { |
2149 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2149 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2150 | 2150 | return $count; |
2151 | 2151 | } |
2152 | 2152 | |
@@ -2160,9 +2160,9 @@ discard block |
||
2160 | 2160 | */ |
2161 | 2161 | public function total_events_draft() { |
2162 | 2162 | $where = array( |
2163 | - 'status' => array( 'IN', array( 'draft', 'auto-draft' ) ), |
|
2163 | + 'status' => array('IN', array('draft', 'auto-draft')), |
|
2164 | 2164 | ); |
2165 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2165 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2166 | 2166 | return $count; |
2167 | 2167 | } |
2168 | 2168 | |
@@ -2178,7 +2178,7 @@ discard block |
||
2178 | 2178 | $where = array( |
2179 | 2179 | 'status' => 'trash', |
2180 | 2180 | ); |
2181 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2181 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2182 | 2182 | return $count; |
2183 | 2183 | } |
2184 | 2184 | |
@@ -2209,12 +2209,12 @@ discard block |
||
2209 | 2209 | EE_Registry::instance()->CFG->registration->default_STS_ID, |
2210 | 2210 | $this->_template_args['reg_status_array'] |
2211 | 2211 | ) |
2212 | - ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) |
|
2212 | + ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) |
|
2213 | 2213 | : EEM_Registration::status_id_pending_payment; |
2214 | - $this->_set_add_edit_form_tags( 'update_default_event_settings' ); |
|
2215 | - $this->_set_publish_post_box_vars( null, false, false, null, false ); |
|
2214 | + $this->_set_add_edit_form_tags('update_default_event_settings'); |
|
2215 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
2216 | 2216 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2217 | - EVENTS_TEMPLATE_PATH . 'event_settings.template.php', |
|
2217 | + EVENTS_TEMPLATE_PATH.'event_settings.template.php', |
|
2218 | 2218 | $this->_template_args, |
2219 | 2219 | true |
2220 | 2220 | ); |
@@ -2230,8 +2230,8 @@ discard block |
||
2230 | 2230 | * @return void |
2231 | 2231 | */ |
2232 | 2232 | protected function _update_default_event_settings() { |
2233 | - EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] ) |
|
2234 | - ? sanitize_text_field( $this->_req_data['default_reg_status'] ) |
|
2233 | + EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status']) |
|
2234 | + ? sanitize_text_field($this->_req_data['default_reg_status']) |
|
2235 | 2235 | : EEM_Registration::status_id_pending_payment; |
2236 | 2236 | $what = 'Default Event Settings'; |
2237 | 2237 | $success = $this->_update_espresso_configuration( |
@@ -2241,7 +2241,7 @@ discard block |
||
2241 | 2241 | __FUNCTION__, |
2242 | 2242 | __LINE__ |
2243 | 2243 | ); |
2244 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) ); |
|
2244 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings')); |
|
2245 | 2245 | } |
2246 | 2246 | |
2247 | 2247 | |
@@ -2251,20 +2251,20 @@ discard block |
||
2251 | 2251 | |
2252 | 2252 | |
2253 | 2253 | protected function _template_settings() { |
2254 | - $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
|
2254 | + $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
|
2255 | 2255 | $this->_template_args['preview_img'] = '<img src="' |
2256 | 2256 | . EVENTS_ASSETS_URL |
2257 | 2257 | . DS |
2258 | 2258 | . 'images' |
2259 | 2259 | . DS |
2260 | 2260 | . 'caffeinated_template_features.jpg" alt="' |
2261 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2261 | + . esc_attr__('Template Settings Preview screenshot', 'event_espresso') |
|
2262 | 2262 | . '" />'; |
2263 | - $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
|
2263 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__( |
|
2264 | 2264 | '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.', |
2265 | 2265 | 'event_espresso' |
2266 | - ) . '</strong>'; |
|
2267 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2266 | + ).'</strong>'; |
|
2267 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2268 | 2268 | } |
2269 | 2269 | |
2270 | 2270 | |
@@ -2276,18 +2276,18 @@ discard block |
||
2276 | 2276 | * @return void |
2277 | 2277 | */ |
2278 | 2278 | private function _set_category_object() { |
2279 | - if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) { |
|
2279 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
2280 | 2280 | return; |
2281 | 2281 | } //already have the category object so get out. |
2282 | 2282 | //set default category object |
2283 | 2283 | $this->_set_empty_category_object(); |
2284 | 2284 | //only set if we've got an id |
2285 | - if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) { |
|
2285 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2286 | 2286 | return; |
2287 | 2287 | } |
2288 | - $category_id = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
2289 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2290 | - if ( ! empty( $term ) ) { |
|
2288 | + $category_id = absint($this->_req_data['EVT_CAT_ID']); |
|
2289 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2290 | + if ( ! empty($term)) { |
|
2291 | 2291 | $this->_category->category_name = $term->name; |
2292 | 2292 | $this->_category->category_identifier = $term->slug; |
2293 | 2293 | $this->_category->category_desc = $term->description; |
@@ -2307,9 +2307,9 @@ discard block |
||
2307 | 2307 | |
2308 | 2308 | |
2309 | 2309 | protected function _category_list_table() { |
2310 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2311 | - $this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' ); |
|
2312 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
2310 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2311 | + $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
|
2312 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
2313 | 2313 | 'add_category', |
2314 | 2314 | 'add_category', |
2315 | 2315 | array(), |
@@ -2323,20 +2323,20 @@ discard block |
||
2323 | 2323 | /** |
2324 | 2324 | * @param $view |
2325 | 2325 | */ |
2326 | - protected function _category_details( $view ) { |
|
2326 | + protected function _category_details($view) { |
|
2327 | 2327 | //load formatter helper |
2328 | 2328 | //load field generator helper |
2329 | 2329 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2330 | - $this->_set_add_edit_form_tags( $route ); |
|
2330 | + $this->_set_add_edit_form_tags($route); |
|
2331 | 2331 | $this->_set_category_object(); |
2332 | - $id = ! empty( $this->_category->id ) ? $this->_category->id : ''; |
|
2332 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2333 | 2333 | $delete_action = 'delete_category'; |
2334 | 2334 | //custom redirect |
2335 | 2335 | $redirect = EE_Admin_Page::add_query_args_and_nonce( |
2336 | - array( 'action' => 'category_list' ), |
|
2336 | + array('action' => 'category_list'), |
|
2337 | 2337 | $this->_admin_base_url |
2338 | 2338 | ); |
2339 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2339 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2340 | 2340 | //take care of contents |
2341 | 2341 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
2342 | 2342 | $this->display_admin_page_with_sidebar(); |
@@ -2350,21 +2350,21 @@ discard block |
||
2350 | 2350 | protected function _category_details_content() { |
2351 | 2351 | $editor_args['category_desc'] = array( |
2352 | 2352 | 'type' => 'wp_editor', |
2353 | - 'value' => EEH_Formatter::admin_format_content( $this->_category->category_desc ), |
|
2353 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
2354 | 2354 | 'class' => 'my_editor_custom', |
2355 | - 'wpeditor_args' => array( 'media_buttons' => false ), |
|
2355 | + 'wpeditor_args' => array('media_buttons' => false), |
|
2356 | 2356 | ); |
2357 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2357 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2358 | 2358 | $all_terms = get_terms( |
2359 | - array( 'espresso_event_categories' ), |
|
2360 | - array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) |
|
2359 | + array('espresso_event_categories'), |
|
2360 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
2361 | 2361 | ); |
2362 | 2362 | //setup category select for term parents. |
2363 | 2363 | $category_select_values[] = array( |
2364 | - 'text' => esc_html__( 'No Parent', 'event_espresso' ), |
|
2364 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
2365 | 2365 | 'id' => 0, |
2366 | 2366 | ); |
2367 | - foreach ( $all_terms as $term ) { |
|
2367 | + foreach ($all_terms as $term) { |
|
2368 | 2368 | $category_select_values[] = array( |
2369 | 2369 | 'text' => $term->name, |
2370 | 2370 | 'id' => $term->term_id, |
@@ -2378,28 +2378,28 @@ discard block |
||
2378 | 2378 | $template_args = array( |
2379 | 2379 | 'category' => $this->_category, |
2380 | 2380 | 'category_select' => $category_select, |
2381 | - 'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ), |
|
2381 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
2382 | 2382 | 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
2383 | 2383 | 'disable' => '', |
2384 | 2384 | 'disabled_message' => false, |
2385 | 2385 | ); |
2386 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2387 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
2386 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2387 | + return EEH_Template::display_template($template, $template_args, true); |
|
2388 | 2388 | } |
2389 | 2389 | |
2390 | 2390 | |
2391 | 2391 | |
2392 | 2392 | protected function _delete_categories() { |
2393 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2393 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2394 | 2394 | : (array) $this->_req_data['category_id']; |
2395 | - foreach ( $cat_ids as $cat_id ) { |
|
2396 | - $this->_delete_category( $cat_id ); |
|
2395 | + foreach ($cat_ids as $cat_id) { |
|
2396 | + $this->_delete_category($cat_id); |
|
2397 | 2397 | } |
2398 | 2398 | //doesn't matter what page we're coming from... we're going to the same place after delete. |
2399 | 2399 | $query_args = array( |
2400 | 2400 | 'action' => 'category_list', |
2401 | 2401 | ); |
2402 | - $this->_redirect_after_action( 0, '', '', $query_args ); |
|
2402 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | |
@@ -2407,9 +2407,9 @@ discard block |
||
2407 | 2407 | /** |
2408 | 2408 | * @param $cat_id |
2409 | 2409 | */ |
2410 | - protected function _delete_category( $cat_id ) { |
|
2411 | - $cat_id = absint( $cat_id ); |
|
2412 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2410 | + protected function _delete_category($cat_id) { |
|
2411 | + $cat_id = absint($cat_id); |
|
2412 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2413 | 2413 | } |
2414 | 2414 | |
2415 | 2415 | |
@@ -2417,18 +2417,18 @@ discard block |
||
2417 | 2417 | /** |
2418 | 2418 | * @param $new_category |
2419 | 2419 | */ |
2420 | - protected function _insert_or_update_category( $new_category ) { |
|
2421 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true ); |
|
2420 | + protected function _insert_or_update_category($new_category) { |
|
2421 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
2422 | 2422 | $success = 0; //we already have a success message so lets not send another. |
2423 | - if ( $cat_id ) { |
|
2423 | + if ($cat_id) { |
|
2424 | 2424 | $query_args = array( |
2425 | 2425 | 'action' => 'edit_category', |
2426 | 2426 | 'EVT_CAT_ID' => $cat_id, |
2427 | 2427 | ); |
2428 | 2428 | } else { |
2429 | - $query_args = array( 'action' => 'add_category' ); |
|
2429 | + $query_args = array('action' => 'add_category'); |
|
2430 | 2430 | } |
2431 | - $this->_redirect_after_action( $success, '', '', $query_args, true ); |
|
2431 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
2432 | 2432 | } |
2433 | 2433 | |
2434 | 2434 | |
@@ -2437,14 +2437,14 @@ discard block |
||
2437 | 2437 | * @param bool $update |
2438 | 2438 | * @return bool|mixed|string |
2439 | 2439 | */ |
2440 | - private function _insert_category( $update = false ) { |
|
2440 | + private function _insert_category($update = false) { |
|
2441 | 2441 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2442 | - $category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2443 | - $category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2444 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2445 | - if ( empty( $category_name ) ) { |
|
2446 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2447 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2442 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2443 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2444 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2445 | + if (empty($category_name)) { |
|
2446 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2447 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2448 | 2448 | return false; |
2449 | 2449 | } |
2450 | 2450 | $term_args = array( |
@@ -2453,22 +2453,22 @@ discard block |
||
2453 | 2453 | 'parent' => $category_parent, |
2454 | 2454 | ); |
2455 | 2455 | //was the category_identifier input disabled? |
2456 | - if ( isset( $this->_req_data['category_identifier'] ) ) { |
|
2456 | + if (isset($this->_req_data['category_identifier'])) { |
|
2457 | 2457 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2458 | 2458 | } |
2459 | 2459 | $insert_ids = $update |
2460 | - ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) |
|
2461 | - : wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2462 | - if ( ! is_array( $insert_ids ) ) { |
|
2460 | + ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) |
|
2461 | + : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2462 | + if ( ! is_array($insert_ids)) { |
|
2463 | 2463 | $msg = esc_html__( |
2464 | 2464 | 'An error occurred and the category has not been saved to the database.', |
2465 | 2465 | 'event_espresso' |
2466 | 2466 | ); |
2467 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2467 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2468 | 2468 | } else { |
2469 | 2469 | $cat_id = $insert_ids['term_id']; |
2470 | - $msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name ); |
|
2471 | - EE_Error::add_success( $msg ); |
|
2470 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2471 | + EE_Error::add_success($msg); |
|
2472 | 2472 | } |
2473 | 2473 | return $cat_id; |
2474 | 2474 | } |
@@ -2481,28 +2481,28 @@ discard block |
||
2481 | 2481 | * @param bool $count |
2482 | 2482 | * @return \EE_Base_Class[]|int |
2483 | 2483 | */ |
2484 | - public function get_categories( $per_page = 10, $current_page = 1, $count = false ) { |
|
2484 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) { |
|
2485 | 2485 | //testing term stuff |
2486 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2487 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2488 | - $limit = ( $current_page - 1 ) * $per_page; |
|
2489 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2490 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2491 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2486 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2487 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2488 | + $limit = ($current_page - 1) * $per_page; |
|
2489 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2490 | + if (isset($this->_req_data['s'])) { |
|
2491 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2492 | 2492 | $where['OR'] = array( |
2493 | - 'Term.name' => array( 'LIKE', $sstr ), |
|
2494 | - 'description' => array( 'LIKE', $sstr ), |
|
2493 | + 'Term.name' => array('LIKE', $sstr), |
|
2494 | + 'description' => array('LIKE', $sstr), |
|
2495 | 2495 | ); |
2496 | 2496 | } |
2497 | 2497 | $query_params = array( |
2498 | 2498 | $where, |
2499 | - 'order_by' => array( $orderby => $order ), |
|
2500 | - 'limit' => $limit . ',' . $per_page, |
|
2501 | - 'force_join' => array( 'Term' ), |
|
2499 | + 'order_by' => array($orderby => $order), |
|
2500 | + 'limit' => $limit.','.$per_page, |
|
2501 | + 'force_join' => array('Term'), |
|
2502 | 2502 | ); |
2503 | 2503 | $categories = $count |
2504 | - ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) |
|
2505 | - : EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2504 | + ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
2505 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2506 | 2506 | return $categories; |
2507 | 2507 | } |
2508 | 2508 |