@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | protected $_job_step_response = null; |
38 | 38 | |
39 | 39 | |
40 | - public function __construct( $routing = TRUE ) { |
|
41 | - parent::__construct( $routing ); |
|
40 | + public function __construct($routing = TRUE) { |
|
41 | + parent::__construct($routing); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | protected function _ajax_hooks() { |
56 | - add_action('wp_ajax_espresso_batch_continue',array($this,'batch_continue')); |
|
57 | - add_action('wp_ajax_espresso_batch_cleanup',array($this,'batch_cleanup')); |
|
56 | + add_action('wp_ajax_espresso_batch_continue', array($this, 'batch_continue')); |
|
57 | + add_action('wp_ajax_espresso_batch_cleanup', array($this, 'batch_cleanup')); |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | 'nav' => array( |
103 | 103 | 'label' => __('Shortcodes', 'event_espresso'), |
104 | 104 | 'order' => 30), |
105 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ), |
|
105 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
106 | 106 | 'require_nonce' => FALSE |
107 | 107 | ), |
108 | 108 | 'contact_support' => array( |
109 | 109 | 'nav' => array( |
110 | 110 | 'label' => __('Support', 'event_espresso'), |
111 | 111 | 'order' => 40), |
112 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ), |
|
112 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
113 | 113 | 'require_nonce' => FALSE |
114 | 114 | ), |
115 | 115 | 'developers' => array( |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | protected function _installation() { |
140 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
141 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
140 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
141 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
142 | 142 | $this->display_admin_page_with_sidebar(); |
143 | 143 | } |
144 | 144 | |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | 'other_resources' => __('Other Resources', 'event_espresso') |
164 | 164 | ); |
165 | 165 | |
166 | - foreach ( $boxes as $box => $label ) { |
|
167 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
166 | + foreach ($boxes as $box => $label) { |
|
167 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
168 | 168 | $callback_args = array('template_path' => $template_path); |
169 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
169 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | 'shortcodes_event_listings' => __('Event Listings', 'event_espresso'), |
188 | 188 | 'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'), |
189 | 189 | 'shortcodes_category' => __('Event Categories', 'event_espresso'), |
190 | - 'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' ) |
|
190 | + 'shortcodes_attendee' => __('Event Attendees', 'event_espresso') |
|
191 | 191 | /*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/ |
192 | 192 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
193 | 193 | ); |
194 | 194 | |
195 | - foreach ( $boxes as $box => $label ) { |
|
196 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
195 | + foreach ($boxes as $box => $label) { |
|
196 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
197 | 197 | $callback_args = array('template_path' => $template_path); |
198 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
198 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -214,41 +214,41 @@ discard block |
||
214 | 214 | 'important_information' => __('Important Information', 'event_espresso') |
215 | 215 | ); |
216 | 216 | |
217 | - foreach ( $boxes as $box => $label ) { |
|
218 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
217 | + foreach ($boxes as $box => $label) { |
|
218 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
219 | 219 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
220 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
220 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | 224 | |
225 | 225 | protected function _developers() { |
226 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php'; |
|
227 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true ); |
|
226 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php'; |
|
227 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true); |
|
228 | 228 | $this->display_admin_page_with_sidebar(); |
229 | 229 | } |
230 | 230 | |
231 | 231 | public function load_scripts_styles_batch_create() { |
232 | 232 | $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job(); |
233 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
234 | - wp_localize_script( 'support_batch_runner', 'ee_job_response', $job_response->to_array() ); |
|
235 | - wp_localize_script( 'support_batch_runner', 'ee_job_i18n', |
|
233 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
234 | + wp_localize_script('support_batch_runner', 'ee_job_response', $job_response->to_array()); |
|
235 | + wp_localize_script('support_batch_runner', 'ee_job_i18n', |
|
236 | 236 | array( |
237 | - 'redirect_url' => $this->_req_data['redirect_url' ], |
|
237 | + 'redirect_url' => $this->_req_data['redirect_url'], |
|
238 | 238 | )); |
239 | 239 | } |
240 | 240 | public function load_scripts_styles_batch_file_create() { |
241 | 241 | //creates a job based on the request variable |
242 | 242 | $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job(); |
243 | - wp_enqueue_script( 'support_batch_file_runner', EE_SUPPORT_ASSETS_URL . 'support_batch_file_runner.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION,true); |
|
244 | - wp_localize_script( 'support_batch_file_runner', 'ee_job_response', $job_response->to_array() ); |
|
245 | - wp_localize_script( 'support_batch_file_runner', 'ee_job_i18n', |
|
243 | + wp_enqueue_script('support_batch_file_runner', EE_SUPPORT_ASSETS_URL.'support_batch_file_runner.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true); |
|
244 | + wp_localize_script('support_batch_file_runner', 'ee_job_response', $job_response->to_array()); |
|
245 | + wp_localize_script('support_batch_file_runner', 'ee_job_i18n', |
|
246 | 246 | array( |
247 | 247 | 'download_and_redirecting' => sprintf( |
248 | 248 | __('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'), |
249 | - '<a href="' . $this->_req_data['redirect_url' ] .'">', |
|
249 | + '<a href="'.$this->_req_data['redirect_url'].'">', |
|
250 | 250 | '</a>' ), |
251 | - 'redirect_url' => $this->_req_data['redirect_url' ], |
|
251 | + 'redirect_url' => $this->_req_data['redirect_url'], |
|
252 | 252 | )); |
253 | 253 | } |
254 | 254 | |
@@ -259,16 +259,16 @@ discard block |
||
259 | 259 | * @return \EventEspressoBatchRequest\Helpers\JobStepResponse |
260 | 260 | */ |
261 | 261 | protected function _enqueue_batch_job_scripts_and_styles_and_start_job() { |
262 | - wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) ); |
|
263 | - wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION ); |
|
264 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
265 | - $job_handler_classname = stripslashes( $this->_req_data[ 'job_handler' ] ); |
|
262 | + wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery')); |
|
263 | + wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION); |
|
264 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
265 | + $job_handler_classname = stripslashes($this->_req_data['job_handler']); |
|
266 | 266 | $request_data = array_diff_key( |
267 | 267 | $this->_req_data, |
268 | - array_flip( array( 'action', 'page' ) ) ); |
|
268 | + array_flip(array('action', 'page')) ); |
|
269 | 269 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
270 | 270 | //eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' |
271 | - $job_response = $batch_runner->create_job( $job_handler_classname, $request_data ); |
|
271 | + $job_response = $batch_runner->create_job($job_handler_classname, $request_data); |
|
272 | 272 | //remember the response for later. We need it to display the page body |
273 | 273 | $this->_job_step_response = $job_response; |
274 | 274 | return $job_response; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Invokes the report-generating code |
278 | 278 | */ |
279 | 279 | protected function batch_create() { |
280 | - echo EEH_Template::locate_template( EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_runner.template.html' ); |
|
280 | + echo EEH_Template::locate_template(EE_SUPPORT_ADMIN.'templates'.DS.'admin_batch_runner.template.html'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | * and then sends the user back to wherever they were before |
286 | 286 | */ |
287 | 287 | protected function batch_file_create() { |
288 | - if( $this->_job_step_response instanceof \EventEspressoBatchRequest\Helpers\JobStepResponse ) { |
|
289 | - $filename = EEH_File::get_filename_from_filepath( $this->_job_step_response->job_parameters()->extra_datum( 'filepath' ) ); |
|
288 | + if ($this->_job_step_response instanceof \EventEspressoBatchRequest\Helpers\JobStepResponse) { |
|
289 | + $filename = EEH_File::get_filename_from_filepath($this->_job_step_response->job_parameters()->extra_datum('filepath')); |
|
290 | 290 | } else { |
291 | - $filename = __( 'Unknown', 'event_espresso' ); |
|
291 | + $filename = __('Unknown', 'event_espresso'); |
|
292 | 292 | } |
293 | 293 | echo EEH_Template::locate_template( |
294 | - EE_SUPPORT_ADMIN . 'templates' . DS . 'admin_batch_file_runner.template.html', |
|
294 | + EE_SUPPORT_ADMIN.'templates'.DS.'admin_batch_file_runner.template.html', |
|
295 | 295 | array( |
296 | 296 | 'filename' => $filename |
297 | 297 | ) |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * Receives ajax calls for continuing a job |
303 | 303 | */ |
304 | 304 | public function batch_continue() { |
305 | - $job_id = sanitize_text_field( $this->_req_data[ 'job_id' ] ); |
|
305 | + $job_id = sanitize_text_field($this->_req_data['job_id']); |
|
306 | 306 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
307 | - $responseobj = $batch_runner->continue_job( $job_id); |
|
308 | - $this->_template_args[ 'data' ] = $responseobj->to_array(); |
|
307 | + $responseobj = $batch_runner->continue_job($job_id); |
|
308 | + $this->_template_args['data'] = $responseobj->to_array(); |
|
309 | 309 | $this->_return_json(); |
310 | 310 | } |
311 | 311 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * @return type |
315 | 315 | */ |
316 | 316 | public function batch_cleanup() { |
317 | - $job_id = sanitize_text_field( $this->_req_data[ 'job_id' ] ); |
|
317 | + $job_id = sanitize_text_field($this->_req_data['job_id']); |
|
318 | 318 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
319 | - $response_obj = $batch_runner->cleanup_job( $job_id ); |
|
320 | - $this->_template_args[ 'data' ] = $response_obj->to_array(); |
|
319 | + $response_obj = $batch_runner->cleanup_job($job_id); |
|
320 | + $this->_template_args['data'] = $response_obj->to_array(); |
|
321 | 321 | $this->_return_json(); |
322 | 322 | } |
323 | 323 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | $this->_name = 'pricing'; |
55 | 55 | |
56 | 56 | //capability check |
57 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) { |
|
57 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
61 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
62 | 62 | |
63 | 63 | //if we were going to add our own metaboxes we'd use the below. |
64 | 64 | $this->_metaboxes = array( |
65 | 65 | 0 => array( |
66 | - 'page_route' => array('edit','create_new'), |
|
66 | + 'page_route' => array('edit', 'create_new'), |
|
67 | 67 | 'func' => 'pricing_metabox', |
68 | 68 | 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
69 | 69 | 'priority' => 'high', |
70 | 70 | 'context' => 'normal' |
71 | 71 | ), |
72 | 72 | |
73 | - );/**/ |
|
73 | + ); /**/ |
|
74 | 74 | |
75 | 75 | $this->_remove_metaboxes = array( |
76 | 76 | 0 => array( |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @var array Expected an array returned with 'date' and 'time' keys. |
91 | 91 | */ |
92 | - $this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
92 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
93 | 93 | 'date' => 'Y-m-d', |
94 | 94 | 'time' => 'h:i a' |
95 | 95 | )); |
96 | 96 | |
97 | 97 | //validate |
98 | - $this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null; |
|
99 | - $this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null; |
|
98 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
99 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
100 | 100 | |
101 | 101 | //validate format strings |
102 | - $format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
103 | - if ( is_array( $format_validation ) ) { |
|
104 | - $msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>'; |
|
105 | - foreach ( $format_validation as $error ) { |
|
106 | - $msg .= '<li>' . $error . '</li>'; |
|
102 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
103 | + if (is_array($format_validation)) { |
|
104 | + $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>'; |
|
105 | + foreach ($format_validation as $error) { |
|
106 | + $msg .= '<li>'.$error.'</li>'; |
|
107 | 107 | } |
108 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
109 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
108 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
109 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
110 | 110 | $this->_date_format_strings = array( |
111 | 111 | 'date' => 'Y-m-d', |
112 | 112 | 'time' => 'h:i a' |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | $this->_scripts_styles = array( |
118 | 118 | 'registers' => array( |
119 | 119 | 'ee-tickets-datetimes-css' => array( |
120 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
120 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
121 | 121 | 'type' => 'css' |
122 | 122 | ), |
123 | 123 | 'ee-dtt-ticket-metabox' => array( |
124 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
124 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
125 | 125 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
126 | 126 | ) |
127 | 127 | ), |
128 | 128 | 'deregisters' => array( |
129 | - 'event-editor-css' => array('type' => 'css' ), |
|
129 | + 'event-editor-css' => array('type' => 'css'), |
|
130 | 130 | 'event-datetime-metabox' => array('type' => 'js') |
131 | 131 | ), |
132 | 132 | 'enqueues' => array( |
133 | - 'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ), |
|
134 | - 'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' ) |
|
133 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
134 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
135 | 135 | ), |
136 | 136 | 'localize' => array( |
137 | 137 | 'ee-dtt-ticket-metabox' => array( |
138 | 138 | 'DTT_TRASH_BLOCK' => array( |
139 | 139 | 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), |
140 | 140 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), |
141 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', |
|
141 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>', |
|
142 | 142 | 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
143 | 143 | 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
144 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>' |
|
144 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>' |
|
145 | 145 | ), |
146 | 146 | 'DTT_ERROR_MSG' => array( |
147 | 147 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
148 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>' |
|
148 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>' |
|
149 | 149 | ), |
150 | 150 | 'DTT_OVERSELL_WARNING' => array( |
151 | 151 | 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'), |
152 | 152 | 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso') |
153 | 153 | ), |
154 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ), |
|
155 | - 'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) ) |
|
154 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), |
|
155 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
156 | 156 | ) |
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | |
160 | 160 | |
161 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 ); |
|
162 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
161 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10); |
|
162 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - public function caf_updates( $update_callbacks ) { |
|
168 | - foreach ( $update_callbacks as $key => $callback ) { |
|
169 | - if ( $callback[1] == '_default_tickets_update' ) |
|
170 | - unset( $update_callbacks[$key] ); |
|
167 | + public function caf_updates($update_callbacks) { |
|
168 | + foreach ($update_callbacks as $key => $callback) { |
|
169 | + if ($callback[1] == '_default_tickets_update') |
|
170 | + unset($update_callbacks[$key]); |
|
171 | 171 | } |
172 | 172 | |
173 | - $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
|
173 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
174 | 174 | return $update_callbacks; |
175 | 175 | } |
176 | 176 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param array $data The request data from the form |
184 | 184 | * @return bool success or fail |
185 | 185 | */ |
186 | - public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
|
186 | + public function dtt_and_tickets_caf_update($evtobj, $data) { |
|
187 | 187 | //first we need to start with datetimes cause they are the "root" items attached to events. |
188 | - $saved_dtts = $this->_update_dtts( $evtobj, $data ); |
|
188 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
189 | 189 | //next tackle the tickets (and prices?) |
190 | - $this->_update_tkts( $evtobj, $saved_dtts, $data ); |
|
190 | + $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,41 +198,41 @@ discard block |
||
198 | 198 | * @param array $data the request data from the form |
199 | 199 | * @return EE_Datetime[] |
200 | 200 | */ |
201 | - protected function _update_dtts( $evt_obj, $data ) { |
|
202 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
201 | + protected function _update_dtts($evt_obj, $data) { |
|
202 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
203 | 203 | $saved_dtt_ids = array(); |
204 | 204 | $saved_dtt_objs = array(); |
205 | 205 | |
206 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
206 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
207 | 207 | //trim all values to ensure any excess whitespace is removed. |
208 | 208 | $dtt = array_map( |
209 | - function( $datetime_data ) { |
|
210 | - return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data ); |
|
209 | + function($datetime_data) { |
|
210 | + return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
|
211 | 211 | }, |
212 | 212 | $dtt |
213 | 213 | ); |
214 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
214 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
215 | 215 | $datetime_values = array( |
216 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
217 | - 'DTT_name' => ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '', |
|
218 | - 'DTT_description' => ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '', |
|
216 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
217 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
218 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
219 | 219 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
220 | 220 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
221 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ], |
|
222 | - 'DTT_order' => ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'], |
|
221 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
222 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
223 | 223 | ); |
224 | 224 | |
225 | 225 | //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. |
226 | 226 | |
227 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
228 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
227 | + if ( ! empty($dtt['DTT_ID'])) { |
|
228 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
229 | 229 | |
230 | 230 | //set date and time format according to what is set in this class. |
231 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
232 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
231 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
232 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
233 | 233 | |
234 | - foreach ( $datetime_values as $field => $value ) { |
|
235 | - $DTM->set( $field, $value ); |
|
234 | + foreach ($datetime_values as $field => $value) { |
|
235 | + $DTM->set($field, $value); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
@@ -240,24 +240,24 @@ discard block |
||
240 | 240 | $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
241 | 241 | |
242 | 242 | } else { |
243 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE ); |
|
243 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE); |
|
244 | 244 | |
245 | 245 | //reset date and times to match the format |
246 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
247 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
248 | - foreach( $datetime_values as $field => $value ) { |
|
249 | - $DTM->set( $field, $value ); |
|
246 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
247 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
248 | + foreach ($datetime_values as $field => $value) { |
|
249 | + $DTM->set($field, $value); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | 253 | |
254 | 254 | $DTM->save(); |
255 | - $DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' ); |
|
255 | + $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
256 | 256 | $evt_obj->save(); |
257 | 257 | |
258 | 258 | //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. |
259 | - if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) { |
|
260 | - $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') ); |
|
259 | + if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
260 | + $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
261 | 261 | EE_Registry::instance()->load_helper('DTT_Helper'); |
262 | 262 | $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
263 | 263 | $DTM->save(); |
@@ -273,25 +273,25 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
276 | - $old_datetimes = explode(',', $data['datetime_IDs'] ); |
|
276 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
277 | 277 | $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
278 | 278 | |
279 | - if ( is_array( $old_datetimes ) ) { |
|
280 | - $dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids ); |
|
281 | - foreach ( $dtts_to_delete as $id ) { |
|
282 | - $id = absint( $id ); |
|
283 | - if ( empty( $id ) ) |
|
279 | + if (is_array($old_datetimes)) { |
|
280 | + $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
281 | + foreach ($dtts_to_delete as $id) { |
|
282 | + $id = absint($id); |
|
283 | + if (empty($id)) |
|
284 | 284 | continue; |
285 | 285 | |
286 | 286 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
287 | 287 | |
288 | 288 | //remove tkt relationships. |
289 | 289 | $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
290 | - foreach ( $related_tickets as $tkt ) { |
|
290 | + foreach ($related_tickets as $tkt) { |
|
291 | 291 | $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
292 | 292 | } |
293 | 293 | |
294 | - $evt_obj->_remove_relation_to( $id, 'Datetime' ); |
|
294 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
295 | 295 | $dtt_to_remove->refresh_cache_of_related_objects(); |
296 | 296 | |
297 | 297 | } |
@@ -312,86 +312,86 @@ discard block |
||
312 | 312 | * @param array $data incoming request data |
313 | 313 | * @return EE_Ticket[] |
314 | 314 | */ |
315 | - protected function _update_tkts( $evtobj, $saved_dtts, $data ) { |
|
315 | + protected function _update_tkts($evtobj, $saved_dtts, $data) { |
|
316 | 316 | |
317 | 317 | $new_tkt = null; |
318 | 318 | $new_default = null; |
319 | 319 | //stripslashes because WP filtered the $_POST ($data) array to add slashes |
320 | 320 | $data = stripslashes_deep($data); |
321 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
321 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
322 | 322 | $saved_tickets = $dtts_on_existing = array(); |
323 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
323 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
324 | 324 | |
325 | 325 | //load money helper |
326 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
326 | + EE_Registry::instance()->load_helper('Money'); |
|
327 | 327 | |
328 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
328 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
329 | 329 | |
330 | 330 | $update_prices = $create_new_TKT = FALSE; |
331 | 331 | |
332 | 332 | //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
333 | 333 | |
334 | - $starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]); |
|
335 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] ); |
|
334 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
335 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
336 | 336 | $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
337 | 337 | $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
338 | 338 | |
339 | 339 | // trim inputs to ensure any excess whitespace is removed. |
340 | 340 | $tkt = array_map( |
341 | - function( $ticket_data ) { |
|
342 | - return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data ); |
|
341 | + function($ticket_data) { |
|
342 | + return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
|
343 | 343 | }, |
344 | 344 | $tkt |
345 | 345 | ); |
346 | 346 | |
347 | 347 | //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
348 | 348 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
349 | - $ticket_price = isset( $tkt['TKT_price'] ) ? round ( (float) $tkt['TKT_price'], 3 ) : 0; |
|
349 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
350 | 350 | |
351 | 351 | //note incoming base price needs converted from localized value. |
352 | - $base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0; |
|
352 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
353 | 353 | //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
354 | 354 | $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
355 | - $base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0; |
|
355 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
356 | 356 | |
357 | 357 | $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
358 | 358 | |
359 | 359 | $now = null; |
360 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
360 | + if (empty($tkt['TKT_start_date'])) { |
|
361 | 361 | //lets' use now in the set timezone. |
362 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
363 | - $tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
362 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
363 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
364 | 364 | } |
365 | 365 | |
366 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
366 | + if (empty($tkt['TKT_end_date'])) { |
|
367 | 367 | /** |
368 | 368 | * set the TKT_end_date to the first datetime attached to the ticket. |
369 | 369 | */ |
370 | - $first_dtt = $saved_dtts[reset( $tkt_dtt_rows )]; |
|
371 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] ); |
|
370 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
371 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $TKT_values = array( |
375 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
376 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
377 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
378 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
375 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
376 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
377 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
378 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
379 | 379 | 'TKT_start_date' => $tkt['TKT_start_date'], |
380 | 380 | 'TKT_end_date' => $tkt['TKT_end_date'], |
381 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ], |
|
382 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'], |
|
383 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
384 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
381 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
382 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
383 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
384 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
385 | 385 | 'TKT_row' => $row, |
386 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0, |
|
387 | - 'TKT_taxable' => ! empty( $tkt['TKT_taxable'] ) ? 1 : 0, |
|
388 | - 'TKT_required' => ! empty( $tkt['TKT_required'] ) ? 1 : 0, |
|
386 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
387 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
388 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
389 | 389 | 'TKT_price' => $ticket_price |
390 | 390 | ); |
391 | 391 | |
392 | 392 | |
393 | 393 | //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. |
394 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
394 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
395 | 395 | $TKT_values['TKT_ID'] = 0; |
396 | 396 | $TKT_values['TKT_is_default'] = 0; |
397 | 397 | $update_prices = TRUE; |
@@ -403,21 +403,21 @@ discard block |
||
403 | 403 | // but DID have it's items modified. |
404 | 404 | // keep in mind that if the TKT has been sold (and we have changed pricing information), |
405 | 405 | // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
406 | - if ( absint( $TKT_values['TKT_ID'] ) ) { |
|
407 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
408 | - if ( $TKT instanceof EE_Ticket ) { |
|
406 | + if (absint($TKT_values['TKT_ID'])) { |
|
407 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
408 | + if ($TKT instanceof EE_Ticket) { |
|
409 | 409 | |
410 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
410 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
411 | 411 | // are there any registrations using this ticket ? |
412 | 412 | $tickets_sold = $TKT->count_related( |
413 | 413 | 'Registration', |
414 | - array( array( |
|
415 | - 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) |
|
416 | - ) ) |
|
414 | + array(array( |
|
415 | + 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
416 | + )) |
|
417 | 417 | ); |
418 | 418 | //set ticket formats |
419 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
420 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
419 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
420 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
421 | 421 | |
422 | 422 | // let's just check the total price for the existing ticket |
423 | 423 | // and determine if it matches the new total price. |
@@ -427,17 +427,17 @@ discard block |
||
427 | 427 | ? TRUE : FALSE; |
428 | 428 | |
429 | 429 | //set new values |
430 | - foreach ( $TKT_values as $field => $value ) { |
|
431 | - if ( $field === 'TKT_qty' ) { |
|
432 | - $TKT->set_qty( $value ); |
|
430 | + foreach ($TKT_values as $field => $value) { |
|
431 | + if ($field === 'TKT_qty') { |
|
432 | + $TKT->set_qty($value); |
|
433 | 433 | } else { |
434 | - $TKT->set( $field, $value ); |
|
434 | + $TKT->set($field, $value); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | 438 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
439 | - if ( $create_new_TKT ) { |
|
440 | - $new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id ); |
|
439 | + if ($create_new_TKT) { |
|
440 | + $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | $TKT = EE_Ticket::new_instance( |
447 | 447 | $TKT_values, |
448 | 448 | $timezone, |
449 | - array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ] ) |
|
449 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
450 | 450 | ); |
451 | - if ( $TKT instanceof EE_Ticket ) { |
|
451 | + if ($TKT instanceof EE_Ticket) { |
|
452 | 452 | // make sure ticket has an ID of setting relations won't work |
453 | 453 | $TKT->save(); |
454 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
454 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
455 | 455 | $update_prices = TRUE; |
456 | 456 | } |
457 | 457 | } |
@@ -459,38 +459,38 @@ discard block |
||
459 | 459 | //$TKT->save(); |
460 | 460 | |
461 | 461 | //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. |
462 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
463 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
462 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
463 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
464 | 464 | EE_Registry::instance()->load_helper('DTT_Helper'); |
465 | 465 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
466 | 466 | } |
467 | 467 | |
468 | 468 | //let's make sure the base price is handled |
469 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT; |
|
469 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT; |
|
470 | 470 | |
471 | 471 | //add/update price_modifiers |
472 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT; |
|
472 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
473 | 473 | |
474 | 474 | //need to make sue that the TKT_price is accurate after saving the prices. |
475 | 475 | $TKT->ensure_TKT_Price_correct(); |
476 | 476 | |
477 | 477 | //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
478 | - if ( ! defined('DOING_AUTOSAVE' ) ) { |
|
479 | - if ( !empty($tkt['TKT_is_default_selector'] ) ) { |
|
478 | + if ( ! defined('DOING_AUTOSAVE')) { |
|
479 | + if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
480 | 480 | $update_prices = TRUE; |
481 | 481 | $new_default = clone $TKT; |
482 | - $new_default->set( 'TKT_ID', 0 ); |
|
483 | - $new_default->set( 'TKT_is_default', 1 ); |
|
484 | - $new_default->set( 'TKT_row', 1 ); |
|
485 | - $new_default->set( 'TKT_price', $ticket_price ); |
|
482 | + $new_default->set('TKT_ID', 0); |
|
483 | + $new_default->set('TKT_is_default', 1); |
|
484 | + $new_default->set('TKT_row', 1); |
|
485 | + $new_default->set('TKT_price', $ticket_price); |
|
486 | 486 | //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
487 | 487 | $new_default->_remove_relations('Datetime'); |
488 | 488 | //todo we need to add the current attached prices as new prices to the new default ticket. |
489 | - $new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices ); |
|
489 | + $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
490 | 490 | //don't forget the base price! |
491 | - $new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id ); |
|
491 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id); |
|
492 | 492 | $new_default->save(); |
493 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data ); |
|
493 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -501,19 +501,19 @@ discard block |
||
501 | 501 | //let's assign any tickets that have been setup to the saved_tickets tracker |
502 | 502 | //save existing TKT |
503 | 503 | $TKT->save(); |
504 | - if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) { |
|
504 | + if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
505 | 505 | //save new TKT |
506 | 506 | $new_tkt->save(); |
507 | 507 | //add new ticket to array |
508 | - $saved_tickets[ $new_tkt->ID() ] = $new_tkt; |
|
508 | + $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
509 | 509 | |
510 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data ); |
|
510 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
511 | 511 | |
512 | 512 | } else { |
513 | 513 | //add tkt to saved tkts |
514 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
514 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
515 | 515 | |
516 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data ); |
|
516 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | } |
@@ -523,22 +523,22 @@ discard block |
||
523 | 523 | // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
524 | 524 | // Or a draft event was saved and in the process of editing a ticket is trashed. |
525 | 525 | // No sense in keeping all the related data in the db! |
526 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
527 | - $tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) ); |
|
526 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
527 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
528 | 528 | |
529 | - foreach ( $tickets_removed as $id ) { |
|
530 | - $id = absint( $id ); |
|
529 | + foreach ($tickets_removed as $id) { |
|
530 | + $id = absint($id); |
|
531 | 531 | |
532 | 532 | //get the ticket for this id |
533 | 533 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
534 | 534 | |
535 | 535 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
536 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
536 | + if ($tkt_to_remove->get('TKT_is_default')) |
|
537 | 537 | continue; |
538 | 538 | |
539 | 539 | // if this tkt has any registrations attached so then we just ARCHIVE |
540 | 540 | // because we don't actually permanently delete these tickets. |
541 | - if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
|
541 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
542 | 542 | $tkt_to_remove->delete(); |
543 | 543 | continue; |
544 | 544 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | // (remember this process can ONLY kick off if there are NO tkts_sold) |
548 | 548 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
549 | 549 | |
550 | - foreach( $dtts as $dtt ) { |
|
550 | + foreach ($dtts as $dtt) { |
|
551 | 551 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
552 | 552 | } |
553 | 553 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
556 | 556 | $tkt_to_remove->delete_related_permanently('Price'); |
557 | 557 | |
558 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove ); |
|
558 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
559 | 559 | |
560 | 560 | // finally let's delete this ticket |
561 | 561 | // (which should not be blocked at this point b/c we've removed all our relationships) |
@@ -587,39 +587,39 @@ discard block |
||
587 | 587 | // and removing the ticket from datetimes it got removed from. |
588 | 588 | |
589 | 589 | // first let's add datetimes |
590 | - if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) { |
|
591 | - foreach ( $added_datetimes as $row_id ) { |
|
592 | - $row_id = (int)$row_id; |
|
593 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
594 | - $ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
590 | + if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
591 | + foreach ($added_datetimes as $row_id) { |
|
592 | + $row_id = (int) $row_id; |
|
593 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
594 | + $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
595 | 595 | // Is this an existing ticket (has an ID) and does it have any sold? |
596 | 596 | // If so, then we need to add that to the DTT sold because this DTT is getting added. |
597 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
598 | - $saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() ); |
|
599 | - $saved_datetimes[ $row_id ]->save(); |
|
597 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
598 | + $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
599 | + $saved_datetimes[$row_id]->save(); |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
603 | 603 | } |
604 | 604 | // then remove datetimes |
605 | - if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) { |
|
606 | - foreach ( $removed_datetimes as $row_id ) { |
|
607 | - $row_id = (int)$row_id; |
|
605 | + if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
606 | + foreach ($removed_datetimes as $row_id) { |
|
607 | + $row_id = (int) $row_id; |
|
608 | 608 | // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
609 | 609 | // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
610 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
611 | - $ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
610 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
611 | + $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
612 | 612 | // Is this an existing ticket (has an ID) and does it have any sold? |
613 | 613 | // If so, then we need to remove it's sold from the DTT_sold. |
614 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
615 | - $saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() ); |
|
616 | - $saved_datetimes[ $row_id ]->save(); |
|
614 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
615 | + $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
616 | + $saved_datetimes[$row_id]->save(); |
|
617 | 617 | } |
618 | 618 | } |
619 | 619 | } |
620 | 620 | } |
621 | 621 | // cap ticket qty by datetime reg limits |
622 | - $ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) ); |
|
622 | + $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
623 | 623 | return $ticket; |
624 | 624 | } |
625 | 625 | |
@@ -640,39 +640,39 @@ discard block |
||
640 | 640 | EE_Ticket $ticket, |
641 | 641 | $price_rows = array(), |
642 | 642 | $ticket_price = 0, |
643 | - $base_price = 0 , |
|
643 | + $base_price = 0, |
|
644 | 644 | $base_price_id = 0 |
645 | 645 | ) { |
646 | 646 | |
647 | 647 | // create new ticket that's a copy of the existing |
648 | 648 | // except a new id of course (and not archived) |
649 | 649 | // AND has the new TKT_price associated with it. |
650 | - $new_ticket = clone( $ticket ); |
|
651 | - $new_ticket->set( 'TKT_ID', 0 ); |
|
652 | - $new_ticket->set( 'TKT_deleted', 0 ); |
|
653 | - $new_ticket->set( 'TKT_price', $ticket_price ); |
|
654 | - $new_ticket->set( 'TKT_sold', 0 ); |
|
650 | + $new_ticket = clone($ticket); |
|
651 | + $new_ticket->set('TKT_ID', 0); |
|
652 | + $new_ticket->set('TKT_deleted', 0); |
|
653 | + $new_ticket->set('TKT_price', $ticket_price); |
|
654 | + $new_ticket->set('TKT_sold', 0); |
|
655 | 655 | // let's get a new ID for this ticket |
656 | 656 | $new_ticket->save(); |
657 | 657 | // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
658 | - $datetimes_on_existing = $ticket->get_many_related( 'Datetime' ); |
|
658 | + $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
659 | 659 | $new_ticket = $this->_update_ticket_datetimes( |
660 | 660 | $new_ticket, |
661 | 661 | $datetimes_on_existing, |
662 | - array_keys( $datetimes_on_existing ) |
|
662 | + array_keys($datetimes_on_existing) |
|
663 | 663 | ); |
664 | 664 | |
665 | 665 | // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
666 | 666 | // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
667 | 667 | // available. |
668 | - if ( $ticket->sold() > 0 ) { |
|
668 | + if ($ticket->sold() > 0) { |
|
669 | 669 | $new_qty = $ticket->qty() - $ticket->sold(); |
670 | - $new_ticket->set_qty( $new_qty ); |
|
670 | + $new_ticket->set_qty($new_qty); |
|
671 | 671 | } |
672 | 672 | //now we update the prices just for this ticket |
673 | - $new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true ); |
|
673 | + $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
674 | 674 | //and we update the base price |
675 | - $new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id ); |
|
675 | + $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
676 | 676 | return $new_ticket; |
677 | 677 | } |
678 | 678 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
693 | 693 | * @return EE_Ticket |
694 | 694 | */ |
695 | - protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
|
695 | + protected function _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) { |
|
696 | 696 | |
697 | 697 | //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
698 | 698 | $current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers(); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | $updated_prices = array(); |
701 | 701 | |
702 | 702 | // if $base_price ! FALSE then updating a base price. |
703 | - if ( $base_price !== FALSE ) { |
|
703 | + if ($base_price !== FALSE) { |
|
704 | 704 | $prices[1] = array( |
705 | 705 | 'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id, |
706 | 706 | 'PRT_ID' => 1, |
@@ -711,47 +711,47 @@ discard block |
||
711 | 711 | } |
712 | 712 | |
713 | 713 | //possibly need to save tkt |
714 | - if ( ! $ticket->ID() ) |
|
714 | + if ( ! $ticket->ID()) |
|
715 | 715 | $ticket->save(); |
716 | 716 | |
717 | - foreach ( $prices as $row => $prc ) { |
|
718 | - $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
|
719 | - if ( empty($prt_id) ) |
|
717 | + foreach ($prices as $row => $prc) { |
|
718 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL; |
|
719 | + if (empty($prt_id)) |
|
720 | 720 | continue; //prices MUST have a price type id. |
721 | 721 | $PRC_values = array( |
722 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
722 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
723 | 723 | 'PRT_ID' => $prt_id, |
724 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
725 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
726 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
724 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
725 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
726 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
727 | 727 | 'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor |
728 | 728 | 'PRC_order' => $row |
729 | 729 | ); |
730 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
730 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
731 | 731 | $PRC_values['PRC_ID'] = 0; |
732 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
732 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
733 | 733 | } else { |
734 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
734 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
735 | 735 | //update this price with new values |
736 | - foreach ( $PRC_values as $field => $newprc ) { |
|
737 | - $PRC->set( $field, $newprc ); |
|
736 | + foreach ($PRC_values as $field => $newprc) { |
|
737 | + $PRC->set($field, $newprc); |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | $PRC->save(); |
741 | 741 | $prcid = $PRC->ID(); |
742 | 742 | $updated_prices[$prcid] = $PRC; |
743 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | //now let's remove any prices that got removed from the ticket |
747 | - if ( !empty ( $current_prices_on_ticket ) ) { |
|
747 | + if ( ! empty ($current_prices_on_ticket)) { |
|
748 | 748 | $current = array_keys($current_prices_on_ticket); |
749 | 749 | $updated = array_keys($updated_prices); |
750 | 750 | $prices_to_remove = array_diff($current, $updated); |
751 | - if ( !empty( $prices_to_remove ) ) { |
|
752 | - foreach ( $prices_to_remove as $prc_id ) { |
|
751 | + if ( ! empty($prices_to_remove)) { |
|
752 | + foreach ($prices_to_remove as $prc_id) { |
|
753 | 753 | $p = $current_prices_on_ticket[$prc_id]; |
754 | - $ticket->_remove_relation_to( $p, 'Price' ); |
|
754 | + $ticket->_remove_relation_to($p, 'Price'); |
|
755 | 755 | |
756 | 756 | //delete permanently the price |
757 | 757 | $p->delete_permanently(); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | |
766 | 766 | |
767 | - public function autosave_handling( $event_admin_obj ) { |
|
767 | + public function autosave_handling($event_admin_obj) { |
|
768 | 768 | return $event_admin_obj; //doing nothing for the moment. |
769 | 769 | //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
770 | 770 | |
@@ -798,12 +798,12 @@ discard block |
||
798 | 798 | |
799 | 799 | //default main template args |
800 | 800 | $main_template_args = array( |
801 | - 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
801 | + 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
802 | 802 | 'existing_datetime_ids' => '', |
803 | 803 | 'total_dtt_rows' => 1, |
804 | - 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
804 | + 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
805 | 805 | 'datetime_rows' => '', |
806 | - 'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
806 | + 'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
807 | 807 | 'ticket_rows' => '', |
808 | 808 | 'existing_ticket_ids' => '', |
809 | 809 | 'total_ticket_rows' => 1, |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | |
814 | 814 | $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL; |
815 | 815 | |
816 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
816 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
817 | 817 | |
818 | 818 | /** |
819 | 819 | * 1. Start with retrieving Datetimes |
@@ -821,25 +821,25 @@ discard block |
||
821 | 821 | * 3. For each ticket get related prices |
822 | 822 | */ |
823 | 823 | |
824 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) ); |
|
825 | - $times = $DTM->get_all_event_dates( $evtID ); |
|
824 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
825 | + $times = $DTM->get_all_event_dates($evtID); |
|
826 | 826 | |
827 | 827 | |
828 | 828 | |
829 | 829 | $main_template_args['total_dtt_rows'] = count($times); |
830 | - foreach ( $times as $time ) { |
|
830 | + foreach ($times as $time) { |
|
831 | 831 | $dttid = $time->get('DTT_ID'); |
832 | 832 | $dttrow = $time->get('DTT_order'); |
833 | 833 | $existing_datetime_ids[] = $dttid; |
834 | 834 | |
835 | 835 | //tickets attached |
836 | - $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array(); |
|
836 | + $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array(); |
|
837 | 837 | |
838 | 838 | //if there are no related tickets this is likely a new event OR autodraft |
839 | 839 | // event so we need to generate the default tickets because dtts |
840 | 840 | // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
841 | 841 | // datetime on the event. |
842 | - if ( empty ( $related_tickets ) && count( $times ) < 2 ) { |
|
842 | + if (empty ($related_tickets) && count($times) < 2) { |
|
843 | 843 | $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
844 | 844 | } |
845 | 845 | |
@@ -848,11 +848,11 @@ discard block |
||
848 | 848 | |
849 | 849 | //loop through and setup the ticket rows and make sure the order is set. |
850 | 850 | $order = 0; |
851 | - foreach ( $related_tickets as $ticket ) { |
|
851 | + foreach ($related_tickets as $ticket) { |
|
852 | 852 | $tktid = $ticket->get('TKT_ID'); |
853 | 853 | $tktrow = $ticket->get('TKT_row'); |
854 | 854 | //we only want unique tickets in our final display!! |
855 | - if ( !in_array( $tktid, $existing_ticket_ids ) ) { |
|
855 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
856 | 856 | $existing_ticket_ids[] = $tktid; |
857 | 857 | $all_tickets[] = $ticket; |
858 | 858 | } |
@@ -861,56 +861,56 @@ discard block |
||
861 | 861 | $datetime_tickets[$dttid][] = $tktrow; |
862 | 862 | |
863 | 863 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
864 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
864 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) |
|
865 | 865 | $ticket_datetimes[$tktid][] = $dttrow; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
869 | - $main_template_args['total_ticket_rows'] = count( $existing_ticket_ids ); |
|
870 | - $main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
871 | - $main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
869 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
870 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
871 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
872 | 872 | |
873 | 873 | //sort $all_tickets by order |
874 | - usort( $all_tickets, function( $a, $b ) { |
|
874 | + usort($all_tickets, function($a, $b) { |
|
875 | 875 | $a_order = (int) $a->get('TKT_order'); |
876 | 876 | $b_order = (int) $b->get('TKT_order'); |
877 | - if ( $a_order == $b_order ) { |
|
877 | + if ($a_order == $b_order) { |
|
878 | 878 | return 0; |
879 | 879 | } |
880 | - return ( $a_order < $b_order ) ? -1 : 1; |
|
880 | + return ($a_order < $b_order) ? -1 : 1; |
|
881 | 881 | }); |
882 | 882 | |
883 | 883 | //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
884 | 884 | $dttrow = 1; |
885 | - foreach ( $times as $time ) { |
|
886 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times ); |
|
885 | + foreach ($times as $time) { |
|
886 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times); |
|
887 | 887 | $dttrow++; |
888 | 888 | } |
889 | 889 | |
890 | 890 | //then loop through all tickets for the ticket rows. |
891 | 891 | $tktrow = 1; |
892 | - foreach ( $all_tickets as $ticket ) { |
|
893 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets ); |
|
892 | + foreach ($all_tickets as $ticket) { |
|
893 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets); |
|
894 | 894 | $tktrow++; |
895 | 895 | } |
896 | 896 | |
897 | 897 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
898 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
899 | - EEH_Template::display_template( $template, $main_template_args ); |
|
898 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
899 | + EEH_Template::display_template($template, $main_template_args); |
|
900 | 900 | return; |
901 | 901 | } |
902 | 902 | |
903 | 903 | |
904 | 904 | |
905 | - protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
|
905 | + protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) { |
|
906 | 906 | |
907 | 907 | $dtt_display_template_args = array( |
908 | - 'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ), |
|
909 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ), |
|
908 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
909 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default), |
|
910 | 910 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
911 | 911 | ); |
912 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
913 | - return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE); |
|
912 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
913 | + return EEH_Template::display_template($template, $dtt_display_template_args, TRUE); |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | * |
929 | 929 | * @return string Generated edit row. |
930 | 930 | */ |
931 | - protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) { |
|
931 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) { |
|
932 | 932 | |
933 | 933 | // if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true. |
934 | 934 | $default = ! $dtt instanceof EE_Datetime ? true : false; |
@@ -936,30 +936,30 @@ discard block |
||
936 | 936 | $template_args = array( |
937 | 937 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
938 | 938 | 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
939 | - 'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
939 | + 'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
940 | 940 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
941 | 941 | 'DTT_name' => $default ? '' : $dtt->name(), |
942 | 942 | 'DTT_description' => $default ? '' : $dtt->description(), |
943 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
944 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
945 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'), |
|
943 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
944 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
945 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
946 | 946 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
947 | 947 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
948 | - 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
949 | - 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
948 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
949 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
950 | 950 | ); |
951 | 951 | |
952 | - $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
952 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
953 | 953 | |
954 | 954 | //allow filtering of template args at this point. |
955 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event ); |
|
955 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
956 | 956 | |
957 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
958 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
957 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
958 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | |
962 | - protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
|
962 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) { |
|
963 | 963 | |
964 | 964 | $template_args = array( |
965 | 965 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
@@ -967,47 +967,47 @@ discard block |
||
967 | 967 | 'DTT_description' => $default ? '' : $dtt->description(), |
968 | 968 | 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
969 | 969 | 'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
970 | - 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
970 | + 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
971 | 971 | 'DTT_ID' => $default ? '' : $dtt->ID() |
972 | 972 | ); |
973 | 973 | |
974 | 974 | //need to setup the list items (but only if this isnt' a default skeleton setup) |
975 | - if ( !$default ) { |
|
975 | + if ( ! $default) { |
|
976 | 976 | $tktrow = 1; |
977 | - foreach ( $all_tickets as $ticket ) { |
|
978 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ); |
|
977 | + foreach ($all_tickets as $ticket) { |
|
978 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default); |
|
979 | 979 | $tktrow++; |
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
983 | 983 | //filter template args at this point |
984 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event ); |
|
984 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
985 | 985 | |
986 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
987 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
986 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
987 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | |
991 | 991 | |
992 | - protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) { |
|
993 | - $tktid = !empty( $ticket ) ? $ticket->ID() : 0; |
|
994 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array(); |
|
992 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) { |
|
993 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
994 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
995 | 995 | |
996 | - $displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0; |
|
996 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
997 | 997 | $template_args = array( |
998 | 998 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
999 | - 'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow, |
|
999 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1000 | 1000 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
1001 | 1001 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
1002 | - 'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1003 | - 'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1002 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1003 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
1004 | 1004 | ); |
1005 | 1005 | |
1006 | 1006 | //filter template args |
1007 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event ); |
|
1007 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
1008 | 1008 | |
1009 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1010 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1009 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1010 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | |
@@ -1029,32 +1029,32 @@ discard block |
||
1029 | 1029 | * |
1030 | 1030 | * @return [type] [description] |
1031 | 1031 | */ |
1032 | - protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) { |
|
1032 | + protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) { |
|
1033 | 1033 | |
1034 | 1034 | //if $ticket is not an instance of EE_Ticket then force default to true. |
1035 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1035 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1036 | 1036 | |
1037 | 1037 | |
1038 | - $prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array(); |
|
1038 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1039 | 1039 | |
1040 | 1040 | // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
1041 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE; |
|
1041 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE; |
|
1042 | 1042 | |
1043 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1043 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1044 | 1044 | |
1045 | 1045 | $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
1046 | - $base_price = $default ? NULL : $ticket->base_price(); |
|
1046 | + $base_price = $default ? NULL : $ticket->base_price(); |
|
1047 | 1047 | $count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE); |
1048 | 1048 | |
1049 | 1049 | //breaking out complicated condition for ticket_status |
1050 | - if ( $default ) { |
|
1051 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1050 | + if ($default) { |
|
1051 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
1052 | 1052 | } else { |
1053 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1053 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | //breaking out complicated condition for TKT_taxable |
1057 | - if ( $default ) { |
|
1057 | + if ($default) { |
|
1058 | 1058 | $TKT_taxable = ''; |
1059 | 1059 | } else { |
1060 | 1060 | $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
@@ -1069,19 +1069,19 @@ discard block |
||
1069 | 1069 | 'edit_tkt_expanded' => '', |
1070 | 1070 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
1071 | 1071 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
1072 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1073 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1074 | - 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1072 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1073 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1074 | + 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1075 | 1075 | 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE), |
1076 | 1076 | 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
1077 | 1077 | 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
1078 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'), |
|
1079 | - 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'), |
|
1080 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'), |
|
1081 | - 'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ), |
|
1082 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max','input'), |
|
1078 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1079 | + 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1080 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1081 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1082 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1083 | 1083 | 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
1084 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ), |
|
1084 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))), |
|
1085 | 1085 | 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
1086 | 1086 | 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
1087 | 1087 | 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
@@ -1090,99 +1090,99 @@ discard block |
||
1090 | 1090 | 'ticket_price_rows' => '', |
1091 | 1091 | 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'), |
1092 | 1092 | 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
1093 | - 'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"', |
|
1094 | - 'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '', |
|
1093 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1094 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1095 | 1095 | 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
1096 | 1096 | 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
1097 | 1097 | 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
1098 | 1098 | 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
1099 | - 'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ), |
|
1099 | + 'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)), |
|
1100 | 1100 | 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
1101 | 1101 | 'TKT_taxable' => $TKT_taxable, |
1102 | 1102 | 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
1103 | 1103 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1104 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ), |
|
1104 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE), |
|
1105 | 1105 | 'TKT_subtotal_amount' => $ticket_subtotal, |
1106 | - 'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ), |
|
1107 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE, |
|
1106 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1107 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE, |
|
1108 | 1108 | 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
1109 | 1109 | 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
1110 | 1110 | 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
1111 | 1111 | ); |
1112 | 1112 | |
1113 | - $template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1113 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1114 | 1114 | |
1115 | 1115 | //handle rows that should NOT be empty |
1116 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1116 | + if (empty($template_args['TKT_start_date'])) { |
|
1117 | 1117 | //if empty then the start date will be now. |
1118 | - $template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp')); |
|
1119 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1118 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp')); |
|
1119 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1120 | 1120 | } |
1121 | 1121 | |
1122 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1122 | + if (empty($template_args['TKT_end_date'])) { |
|
1123 | 1123 | |
1124 | 1124 | //get the earliest datetime (if present); |
1125 | - $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1125 | + $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1126 | 1126 | |
1127 | - if ( !empty( $earliest_dtt ) ) { |
|
1128 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
1127 | + if ( ! empty($earliest_dtt)) { |
|
1128 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1129 | 1129 | } else { |
1130 | 1130 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1131 | - $template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") ) ); |
|
1131 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1132 | 1132 | } |
1133 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1133 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | //generate ticket_datetime items |
1137 | - if ( ! $default ) { |
|
1137 | + if ( ! $default) { |
|
1138 | 1138 | $dttrow = 1; |
1139 | - foreach ( $all_dtts as $dtt ) { |
|
1140 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ); |
|
1139 | + foreach ($all_dtts as $dtt) { |
|
1140 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default); |
|
1141 | 1141 | $dttrow++; |
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | $prcrow = 1; |
1146 | - foreach ( $prices as $price ) { |
|
1147 | - if ( $price->is_base_price() ) { |
|
1146 | + foreach ($prices as $price) { |
|
1147 | + if ($price->is_base_price()) { |
|
1148 | 1148 | $prcrow++; |
1149 | 1149 | continue; |
1150 | 1150 | } |
1151 | - $show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1 ? FALSE : TRUE; |
|
1152 | - $show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE; |
|
1153 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create ); |
|
1151 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE; |
|
1152 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE; |
|
1153 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create); |
|
1154 | 1154 | $prcrow++; |
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | //filter $template_args |
1158 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event ); |
|
1158 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event); |
|
1159 | 1159 | |
1160 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1161 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1160 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1161 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | |
1165 | 1165 | |
1166 | 1166 | |
1167 | 1167 | |
1168 | - protected function _get_tax_rows( $tktrow, $ticket ) { |
|
1168 | + protected function _get_tax_rows($tktrow, $ticket) { |
|
1169 | 1169 | $tax_rows = ''; |
1170 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1170 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1171 | 1171 | $template_args = array(); |
1172 | - $taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1173 | - foreach ( $taxes as $tax ) { |
|
1174 | - $tax_added = $this->_get_tax_added( $tax, $ticket ); |
|
1172 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1173 | + foreach ($taxes as $tax) { |
|
1174 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1175 | 1175 | $template_args = array( |
1176 | - 'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1176 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1177 | 1177 | 'tax_id' => $tax->ID(), |
1178 | 1178 | 'tkt_row' => $tktrow, |
1179 | 1179 | 'tax_label' => $tax->get('PRC_name'), |
1180 | 1180 | 'tax_added' => $tax_added, |
1181 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ), |
|
1181 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE), |
|
1182 | 1182 | 'tax_amount' => $tax->get('PRC_amount') |
1183 | 1183 | ); |
1184 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event ); |
|
1185 | - $tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1184 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1185 | + $tax_rows .= EEH_Template::display_template($template, $template_args, TRUE); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | |
@@ -1190,81 +1190,81 @@ discard block |
||
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | |
1193 | - protected function _get_tax_added( EE_Price $tax, $ticket ) { |
|
1194 | - $subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal(); |
|
1193 | + protected function _get_tax_added(EE_Price $tax, $ticket) { |
|
1194 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1195 | 1195 | return $subtotal * $tax->get('PRC_amount') / 100; |
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | |
1199 | 1199 | |
1200 | 1200 | |
1201 | - protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
|
1202 | - $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1201 | + protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) { |
|
1202 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1203 | 1203 | $template_args = array( |
1204 | 1204 | 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
1205 | 1205 | 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
1206 | 1206 | 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
1207 | - 'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ), |
|
1207 | + 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1208 | 1208 | 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
1209 | 1209 | 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
1210 | 1210 | 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
1211 | 1211 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1212 | 1212 | 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
1213 | - 'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1214 | - 'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1215 | - 'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ), |
|
1216 | - 'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1217 | - 'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ), |
|
1213 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1214 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1215 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1216 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1217 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1218 | 1218 | 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
1219 | 1219 | 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
1220 | - 'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'), |
|
1221 | - 'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1220 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1221 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1222 | 1222 | ); |
1223 | 1223 | |
1224 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event ); |
|
1224 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event); |
|
1225 | 1225 | |
1226 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1227 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1226 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1227 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
1231 | - protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1232 | - if ( $price->is_base_price() ) { |
|
1233 | - return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ); |
|
1231 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1232 | + if ($price->is_base_price()) { |
|
1233 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1234 | 1234 | } else { |
1235 | - return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled ); |
|
1235 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | |
1241 | - protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) { |
|
1241 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) { |
|
1242 | 1242 | $template_args = array( |
1243 | 1243 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1244 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1245 | - 'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'), |
|
1244 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1245 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1246 | 1246 | 'PRT_name' => __('Price', 'event_espresso'), |
1247 | 1247 | 'price_selected_operator' => '+', |
1248 | 1248 | 'price_selected_is_percent' => 0 |
1249 | 1249 | ); |
1250 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1250 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1251 | 1251 | |
1252 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event ); |
|
1252 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1253 | 1253 | |
1254 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1254 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
1258 | 1258 | |
1259 | - protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1260 | - $select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1261 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) ); |
|
1262 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1263 | - $all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array(); |
|
1264 | - $selected_price_type_id = $default && empty( $price ) ? 0 : $price->type(); |
|
1259 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1260 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1261 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3')))); |
|
1262 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1263 | + $all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array(); |
|
1264 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1265 | 1265 | $price_option_spans = ''; |
1266 | 1266 | //setup pricetypes for selector |
1267 | - foreach ( $price_types as $price_type ) { |
|
1267 | + foreach ($price_types as $price_type) { |
|
1268 | 1268 | $all_price_types[] = array( |
1269 | 1269 | 'id' => $price_type->ID(), |
1270 | 1270 | 'text' => $price_type->get('PRT_name'), |
@@ -1276,50 +1276,50 @@ discard block |
||
1276 | 1276 | 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
1277 | 1277 | 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
1278 | 1278 | ); |
1279 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE ); |
|
1279 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1282 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1283 | 1283 | $main_name = $select_name; |
1284 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1284 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1285 | 1285 | |
1286 | 1286 | $template_args = array( |
1287 | 1287 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1288 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1289 | - 'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ), |
|
1288 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1289 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1290 | 1290 | 'main_name' => $main_name, |
1291 | 1291 | 'selected_price_type_id' => $selected_price_type_id, |
1292 | 1292 | 'price_option_spans' => $price_option_spans, |
1293 | - 'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ), |
|
1294 | - 'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ), |
|
1293 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1294 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1295 | 1295 | 'disabled' => $disabled |
1296 | 1296 | ); |
1297 | 1297 | |
1298 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event ); |
|
1298 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1299 | 1299 | |
1300 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1300 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1301 | 1301 | |
1302 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1302 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | |
1306 | 1306 | |
1307 | - protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
|
1308 | - $dttid = !empty($dtt) ? $dtt->ID() : 0; |
|
1309 | - $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1310 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1307 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) { |
|
1308 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1309 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1310 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1311 | 1311 | $template_args = array( |
1312 | - 'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow, |
|
1312 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1313 | 1313 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1314 | - 'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '', |
|
1315 | - 'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '', |
|
1316 | - 'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ), |
|
1314 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1315 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1316 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE), |
|
1317 | 1317 | 'tkt_status_class' => '', |
1318 | 1318 | ); |
1319 | 1319 | |
1320 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event ); |
|
1321 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1322 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1320 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1321 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1322 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | |
@@ -1327,53 +1327,53 @@ discard block |
||
1327 | 1327 | protected function _get_ticket_js_structure($all_dtts, $all_tickets) { |
1328 | 1328 | $template_args = array( |
1329 | 1329 | 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts), |
1330 | - 'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE), |
|
1331 | - 'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ), |
|
1330 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE), |
|
1331 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL), |
|
1332 | 1332 | 'default_price_rows' => '', |
1333 | 1333 | 'default_base_price_amount' => 0, |
1334 | 1334 | 'default_base_price_name' => '', |
1335 | 1335 | 'default_base_price_description' => '', |
1336 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ), |
|
1337 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ), |
|
1336 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE), |
|
1337 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE), |
|
1338 | 1338 | 'existing_available_datetime_tickets_list' => '', |
1339 | 1339 | 'existing_available_ticket_datetimes_list' => '', |
1340 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ), |
|
1341 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ) |
|
1340 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE), |
|
1341 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE) |
|
1342 | 1342 | ); |
1343 | 1343 | |
1344 | 1344 | $tktrow = 1; |
1345 | - foreach ( $all_tickets as $ticket ) { |
|
1346 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE ); |
|
1345 | + foreach ($all_tickets as $ticket) { |
|
1346 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE); |
|
1347 | 1347 | $tktrow++; |
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | |
1351 | 1351 | $dttrow = 1; |
1352 | - foreach ( $all_dtts as $dtt ) { |
|
1353 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE ); |
|
1352 | + foreach ($all_dtts as $dtt) { |
|
1353 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE); |
|
1354 | 1354 | $dttrow++; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
1358 | 1358 | $prcrow = 1; |
1359 | - foreach ( $default_prices as $price ) { |
|
1360 | - if ( $price->is_base_price() ) { |
|
1359 | + foreach ($default_prices as $price) { |
|
1360 | + if ($price->is_base_price()) { |
|
1361 | 1361 | $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
1362 | 1362 | $template_args['default_base_price_name'] = $price->get('PRC_name'); |
1363 | 1363 | $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
1364 | 1364 | $prcrow++; |
1365 | 1365 | continue; |
1366 | 1366 | } |
1367 | - $show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1 ? FALSE : TRUE; |
|
1368 | - $show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE; |
|
1369 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create ); |
|
1367 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE; |
|
1368 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE; |
|
1369 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create); |
|
1370 | 1370 | $prcrow++; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event ); |
|
1373 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1374 | 1374 | |
1375 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1376 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1375 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1376 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $_price_types = array(); |
38 | 38 | |
39 | - public function __construct( $admin_page ) { |
|
39 | + public function __construct($admin_page) { |
|
40 | 40 | parent::__construct($admin_page); |
41 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
41 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
42 | 42 | $this->_PRT = EEM_Price_Type::instance(); |
43 | 43 | $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted(); |
44 | 44 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function _setup_data() { |
50 | 50 | $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
51 | - $this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, false, $trashed ); |
|
52 | - $this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, false ); |
|
53 | - $this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, true ); |
|
51 | + $this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed); |
|
52 | + $this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false); |
|
53 | + $this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->_sortable_columns = array( |
76 | 76 | // true means its already sorted |
77 | - 'name' => array( 'name' => false ), |
|
78 | - 'type' => array( 'type' => false ), |
|
79 | - 'amount' => array( 'amount' => false ) |
|
77 | + 'name' => array('name' => false), |
|
78 | + 'type' => array('type' => false), |
|
79 | + 'amount' => array('amount' => false) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $this->_hidden_columns = array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function _add_view_counts() { |
100 | 100 | $this->_views['all']['count'] = $this->_all_data_count; |
101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) { |
|
101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
102 | 102 | $this->_views['trashed']['count'] = $this->_trashed_count; |
103 | 103 | } |
104 | 104 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | * @param object $item the current item |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - protected function _get_row_class( $item ) { |
|
115 | + protected function _get_row_class($item) { |
|
116 | 116 | static $row_class = ''; |
117 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
117 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
118 | 118 | |
119 | 119 | $new_row = $row_class; |
120 | 120 | |
121 | - if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 ) |
|
121 | + if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) |
|
122 | 122 | $new_row .= ' rowsortable'; |
123 | 123 | |
124 | - return ' class="' . $new_row . '"'; |
|
124 | + return ' class="'.$new_row.'"'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | function column_cb($item) { |
134 | - if ( $item->type_obj()->base_type() !== 1 ) |
|
135 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
134 | + if ($item->type_obj()->base_type() !== 1) |
|
135 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | //Build row actions |
146 | 146 | $actions = array(); |
147 | 147 | // edit price link |
148 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) { |
|
149 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL ); |
|
150 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
148 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) { |
|
149 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL); |
|
150 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
151 | 151 | } |
152 | 152 | |
153 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name(); |
|
153 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name(); |
|
154 | 154 | |
155 | - if ( $item->type_obj()->base_type() !== 1 ) { |
|
155 | + if ($item->type_obj()->base_type() !== 1) { |
|
156 | 156 | if ($this->_view == 'all') { |
157 | 157 | // trash price link |
158 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) { |
|
159 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
160 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) { |
|
159 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
160 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
161 | 161 | } |
162 | 162 | } else { |
163 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) { |
|
163 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) { |
|
164 | 164 | // restore price link |
165 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
166 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
165 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
166 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // delete price link |
170 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) { |
|
171 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
172 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
170 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) { |
|
171 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
172 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
179 | 179 | /* $1%s */ $name_link, |
180 | 180 | /* $2%s */ $item->ID(), |
181 | - /* $3%s */ $this->row_actions( $actions ) |
|
181 | + /* $3%s */ $this->row_actions($actions) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_description($item) { |
198 | - return stripslashes( $item->desc() ); |
|
198 | + return stripslashes($item->desc()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | function column_amount($item) { |
206 | 206 | if ($this->_price_types[$item->type()]->is_percent()) { |
207 | - return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>'; |
|
207 | + return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>'; |
|
208 | 208 | } else { |
209 | - return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>'; |
|
209 | + return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>'; |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
457 | 457 | * @return mixed (int|array) int = count || array of price objects |
458 | 458 | */ |
459 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
459 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
460 | 460 | |
461 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
461 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
462 | 462 | // start with an empty array |
463 | 463 | $event_pricing = array(); |
464 | 464 | |
465 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
466 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
465 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
466 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
467 | 467 | //$PRC = EEM_Price::instance(); |
468 | 468 | |
469 | 469 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
470 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
470 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
471 | 471 | |
472 | 472 | switch ($this->_req_data['orderby']) { |
473 | 473 | case 'name': |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | $orderby = array('PRC_amount'=>$order); |
481 | 481 | break; |
482 | 482 | default: |
483 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
483 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
484 | 484 | } |
485 | 485 | |
486 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
487 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
486 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
487 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
488 | 488 | |
489 | 489 | $_where = array( |
490 | 490 | 'PRC_is_default' => 1, |
491 | 491 | 'PRC_deleted' => $trashed |
492 | 492 | ); |
493 | 493 | |
494 | - $offset = ($current_page-1)*$per_page; |
|
495 | - $limit = array( $offset, $per_page ); |
|
494 | + $offset = ($current_page - 1) * $per_page; |
|
495 | + $limit = array($offset, $per_page); |
|
496 | 496 | |
497 | - if ( isset( $this->_req_data['s'] ) ) { |
|
498 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
497 | + if (isset($this->_req_data['s'])) { |
|
498 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
499 | 499 | $_where['OR'] = array( |
500 | - 'PRC_name' => array('LIKE',$sstr ), |
|
501 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
502 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
503 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
500 | + 'PRC_name' => array('LIKE', $sstr), |
|
501 | + 'PRC_desc' => array('LIKE', $sstr), |
|
502 | + 'PRC_amount' => array('LIKE', $sstr), |
|
503 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
504 | 504 | ); |
505 | 505 | } |
506 | 506 | |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | 'group_by'=>'PRC_ID' |
512 | 512 | ); |
513 | 513 | |
514 | - if($count){ |
|
515 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | - }else{ |
|
514 | + if ($count) { |
|
515 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | + } else { |
|
517 | 517 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
518 | 518 | } |
519 | 519 | } |
@@ -529,40 +529,40 @@ discard block |
||
529 | 529 | * @return void |
530 | 530 | */ |
531 | 531 | protected function _edit_price_details() { |
532 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
532 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
533 | 533 | // grab price ID |
534 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
534 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
535 | 535 | // change page title based on request action |
536 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
536 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
537 | 537 | // add PRC_ID to title if editing |
538 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
538 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
539 | 539 | |
540 | 540 | // get prices |
541 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
541 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
542 | 542 | $PRC = EEM_Price::instance(); |
543 | 543 | |
544 | - if ( $PRC_ID ) { |
|
545 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
544 | + if ($PRC_ID) { |
|
545 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
546 | 546 | $additional_hidden_fields = array( |
547 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
547 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
548 | 548 | ); |
549 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
549 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
550 | 550 | } else { |
551 | 551 | $price = $PRC->get_new_price(); |
552 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
552 | + $this->_set_add_edit_form_tags('insert_price'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $this->_template_args['PRC_ID'] = $PRC_ID; |
556 | 556 | $this->_template_args['price'] = $price; |
557 | 557 | |
558 | 558 | // get price types |
559 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
559 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
560 | 560 | $PRT = EEM_Price_Type::instance(); |
561 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
561 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
562 | 562 | $price_type_names = array(); |
563 | 563 | if (empty($price_types)) { |
564 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
565 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
564 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
565 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
566 | 566 | exit(); |
567 | 567 | } else { |
568 | 568 | foreach ($price_types as $type) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->_template_args['price_types'] = $price_type_names; |
576 | 576 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
577 | 577 | |
578 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
578 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
579 | 579 | // the details template wrapper |
580 | 580 | $this->display_admin_page_with_sidebar(); |
581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return void |
592 | 592 | */ |
593 | 593 | protected function _price_details_meta_boxes() { |
594 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
594 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function _edit_price_details_meta_box() { |
608 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
608 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | protected function set_price_column_values() { |
621 | 621 | |
622 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
622 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
623 | 623 | |
624 | 624 | $set_column_values = array( |
625 | 625 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | * @access protected |
648 | 648 | * @return void |
649 | 649 | */ |
650 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
650 | + protected function _insert_or_update_price($insert = FALSE) { |
|
651 | 651 | |
652 | 652 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
653 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
653 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
654 | 654 | |
655 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
655 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
656 | 656 | $PRC = EEM_Price::instance(); |
657 | 657 | |
658 | 658 | // why be so pessimistic ??? : ( |
@@ -660,14 +660,14 @@ discard block |
||
660 | 660 | |
661 | 661 | $set_column_values = $this->set_price_column_values(); |
662 | 662 | // is this a new Price ? |
663 | - if ( $insert ) { |
|
663 | + if ($insert) { |
|
664 | 664 | // run the insert |
665 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
665 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
666 | 666 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
667 | 667 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
668 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
668 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
669 | 669 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
670 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
670 | + $ticket->_add_relation_to($PR, 'Price'); |
|
671 | 671 | $ticket->save(); |
672 | 672 | } |
673 | 673 | $success = 1; |
@@ -677,29 +677,29 @@ discard block |
||
677 | 677 | } |
678 | 678 | $action_desc = 'created'; |
679 | 679 | } else { |
680 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
680 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
681 | 681 | // run the update |
682 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
683 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
682 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
683 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
684 | 684 | $success = 1; |
685 | 685 | } |
686 | 686 | |
687 | 687 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
688 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
688 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
689 | 689 | |
690 | 690 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
691 | - if ( $PRC_ID === 1 ) { |
|
691 | + if ($PRC_ID === 1) { |
|
692 | 692 | $ticket = $PR->get_first_related('Ticket'); |
693 | - if ( $ticket ) { |
|
694 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
695 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
693 | + if ($ticket) { |
|
694 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
695 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
696 | 696 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
697 | 697 | $ticket->save(); |
698 | 698 | } |
699 | 699 | } else { |
700 | 700 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
701 | 701 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
702 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
702 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
703 | 703 | $ticket->save(); |
704 | 704 | } |
705 | 705 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | $action_desc = 'updated'; |
708 | 708 | } |
709 | 709 | |
710 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
710 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
711 | 711 | |
712 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
712 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
713 | 713 | |
714 | 714 | } |
715 | 715 | |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @access protected |
724 | 724 | * @return void |
725 | 725 | */ |
726 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
726 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
727 | 727 | |
728 | 728 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
729 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
729 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
730 | 730 | |
731 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
731 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
732 | 732 | $PRC = EEM_Price::instance(); |
733 | 733 | |
734 | 734 | $success = 1; |
@@ -737,18 +737,18 @@ discard block |
||
737 | 737 | //get base ticket for updating |
738 | 738 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
739 | 739 | //Checkboxes |
740 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
740 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
741 | 741 | // if array has more than one element than success message should be plural |
742 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
742 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
743 | 743 | // cycle thru checkboxes |
744 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
745 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
744 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
745 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
746 | 746 | $success = 0; |
747 | 747 | } else { |
748 | 748 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
749 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
749 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
750 | 750 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
751 | - if ( $PRC_deleted ) { |
|
751 | + if ($PRC_deleted) { |
|
752 | 752 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
753 | 753 | } else { |
754 | 754 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -760,14 +760,14 @@ discard block |
||
760 | 760 | |
761 | 761 | } else { |
762 | 762 | // grab single id and delete |
763 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
764 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
763 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
764 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
765 | 765 | $success = 0; |
766 | 766 | } else { |
767 | 767 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
768 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
768 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
769 | 769 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
770 | - if ( $PRC_deleted ) { |
|
770 | + if ($PRC_deleted) { |
|
771 | 771 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
772 | 772 | } else { |
773 | 773 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -781,17 +781,17 @@ discard block |
||
781 | 781 | 'action' => 'default' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( $success ) { |
|
785 | - if ( $trash ) { |
|
784 | + if ($success) { |
|
785 | + if ($trash) { |
|
786 | 786 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
787 | 787 | } else { |
788 | 788 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
789 | 789 | } |
790 | 790 | |
791 | - EE_Error::add_success( $msg ); |
|
791 | + EE_Error::add_success($msg); |
|
792 | 792 | } |
793 | 793 | |
794 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
794 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | |
@@ -808,19 +808,19 @@ discard block |
||
808 | 808 | protected function _delete_price() { |
809 | 809 | |
810 | 810 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
811 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
811 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
812 | 812 | |
813 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
813 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
814 | 814 | $PRC = EEM_Price::instance(); |
815 | 815 | |
816 | 816 | $success = 1; |
817 | 817 | //Checkboxes |
818 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
818 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
819 | 819 | // if array has more than one element than success message should be plural |
820 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
820 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
821 | 821 | // cycle thru bulk action checkboxes |
822 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
823 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
822 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
823 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
824 | 824 | $success = 0; |
825 | 825 | } |
826 | 826 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
837 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
838 | 838 | |
839 | 839 | } |
840 | 840 | |
@@ -842,16 +842,16 @@ discard block |
||
842 | 842 | |
843 | 843 | |
844 | 844 | public function update_price_order() { |
845 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
845 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
846 | 846 | |
847 | 847 | // grab our row IDs |
848 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
848 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
849 | 849 | |
850 | - if ( is_array( $row_ids )) { |
|
851 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
850 | + if (is_array($row_ids)) { |
|
851 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
852 | 852 | //Update the prices when re-ordering |
853 | 853 | $id = absint($row_ids[$i]); |
854 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
854 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
855 | 855 | $success = FALSE; |
856 | 856 | } |
857 | 857 | } |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | $success = FALSE; |
860 | 860 | } |
861 | 861 | |
862 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
862 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
863 | 863 | |
864 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
864 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
865 | 865 | die(); |
866 | 866 | } |
867 | 867 | |
@@ -904,46 +904,46 @@ discard block |
||
904 | 904 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
905 | 905 | * @return mixed (int|array) int = count || array of price objects |
906 | 906 | */ |
907 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
907 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
908 | 908 | |
909 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
909 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
910 | 910 | // start with an empty array |
911 | 911 | |
912 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
913 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
912 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
913 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
914 | 914 | |
915 | 915 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
916 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
916 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
917 | 917 | switch ($this->_req_data['orderby']) { |
918 | 918 | case 'name': |
919 | - $orderby = array( 'PRT_name' => $order); |
|
919 | + $orderby = array('PRT_name' => $order); |
|
920 | 920 | break; |
921 | 921 | default: |
922 | - $orderby = array( 'PRT_order' => $order); |
|
922 | + $orderby = array('PRT_order' => $order); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
926 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
927 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
926 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
927 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
928 | 928 | |
929 | - $offset = ($current_page-1)*$per_page; |
|
930 | - $limit = array( $offset, $per_page ); |
|
929 | + $offset = ($current_page - 1) * $per_page; |
|
930 | + $limit = array($offset, $per_page); |
|
931 | 931 | |
932 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
932 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
933 | 933 | |
934 | - if ( isset( $this->_req_data['s'] ) ) { |
|
935 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
934 | + if (isset($this->_req_data['s'])) { |
|
935 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
936 | 936 | $_where['OR'] = array( |
937 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
937 | + 'PRT_name' => array('LIKE', $sstr) |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | $query_params = array( |
941 | 941 | $_where, |
942 | 942 | 'order_by'=>$orderby, |
943 | 943 | 'limit'=>$limit); |
944 | - if($count){ |
|
944 | + if ($count) { |
|
945 | 945 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
946 | - }else{ |
|
946 | + } else { |
|
947 | 947 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
948 | 948 | } |
949 | 949 | |
@@ -963,25 +963,25 @@ discard block |
||
963 | 963 | */ |
964 | 964 | protected function _edit_price_type_details() { |
965 | 965 | |
966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
967 | 967 | |
968 | 968 | |
969 | 969 | // grab price type ID |
970 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
970 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
971 | 971 | // change page title based on request action |
972 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
972 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
973 | 973 | // add PRT_ID to title if editing |
974 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
974 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
975 | 975 | |
976 | 976 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
977 | 977 | |
978 | - if ( $PRT_ID ) { |
|
979 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
980 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
981 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
978 | + if ($PRT_ID) { |
|
979 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
980 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
981 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
982 | 982 | } else { |
983 | 983 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
984 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
984 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -990,19 +990,19 @@ discard block |
||
990 | 990 | |
991 | 991 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
992 | 992 | $select_values = array(); |
993 | - foreach ( $base_types as $ref => $text ) { |
|
994 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
993 | + foreach ($base_types as $ref => $text) { |
|
994 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
995 | 995 | //do not allow creation of base_type_base_prices because that's a system only base type. |
996 | 996 | continue; |
997 | 997 | } |
998 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
998 | + $values[] = array('id' => $ref, 'text' => $text); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
1002 | 1002 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1003 | 1003 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1004 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1005 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1004 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1005 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1006 | 1006 | // the details template wrapper |
1007 | 1007 | $this->display_admin_page_with_sidebar(); |
1008 | 1008 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @return void |
1020 | 1020 | */ |
1021 | 1021 | protected function _price_type_details_meta_boxes() { |
1022 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1022 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | * @return void |
1033 | 1033 | */ |
1034 | 1034 | public function _edit_price_type_details_meta_box() { |
1035 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1035 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | |
@@ -1045,9 +1045,9 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | protected function set_price_type_column_values() { |
1047 | 1047 | |
1048 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1048 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1049 | 1049 | |
1050 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1050 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1051 | 1051 | |
1052 | 1052 | switch ($base_type) { |
1053 | 1053 | |
@@ -1094,12 +1094,12 @@ discard block |
||
1094 | 1094 | * @access protected |
1095 | 1095 | * @return void |
1096 | 1096 | */ |
1097 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1097 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1098 | 1098 | |
1099 | 1099 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1100 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1100 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1101 | 1101 | |
1102 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1102 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1103 | 1103 | $PRT = EEM_Price_Type::instance(); |
1104 | 1104 | |
1105 | 1105 | // why be so pessimistic ??? : ( |
@@ -1107,24 +1107,24 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $set_column_values = $this->set_price_type_column_values(); |
1109 | 1109 | // is this a new Price ? |
1110 | - if ( $new_price_type ) { |
|
1110 | + if ($new_price_type) { |
|
1111 | 1111 | // run the insert |
1112 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1112 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1113 | 1113 | $success = 1; |
1114 | 1114 | } |
1115 | 1115 | $action_desc = 'created'; |
1116 | 1116 | } else { |
1117 | 1117 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1118 | 1118 | // run the update |
1119 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1120 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1119 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1120 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1121 | 1121 | $success = 1; |
1122 | 1122 | } |
1123 | 1123 | $action_desc = 'updated'; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1127 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1126 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1127 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1128 | 1128 | |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1138,49 +1138,49 @@ discard block |
||
1138 | 1138 | * @access protected |
1139 | 1139 | * @return void |
1140 | 1140 | */ |
1141 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1141 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1142 | 1142 | |
1143 | 1143 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1144 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1144 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1145 | 1145 | |
1146 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1146 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1147 | 1147 | $PRT = EEM_Price_Type::instance(); |
1148 | 1148 | |
1149 | 1149 | $success = 1; |
1150 | 1150 | $PRT_deleted = $trash ? TRUE : FALSE; |
1151 | 1151 | //Checkboxes |
1152 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1152 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1153 | 1153 | // if array has more than one element than success message should be plural |
1154 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1155 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1154 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1155 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1156 | 1156 | // cycle thru checkboxes |
1157 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1158 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1157 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1158 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | // grab single id and delete |
1165 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1166 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1165 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1166 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1167 | 1167 | $success = 0; |
1168 | 1168 | } |
1169 | 1169 | $what = 'Price Type'; |
1170 | 1170 | |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $query_args = array( 'action' => 'price_types' ); |
|
1174 | - if ( $success ) { |
|
1175 | - if ( $trash ) { |
|
1173 | + $query_args = array('action' => 'price_types'); |
|
1174 | + if ($success) { |
|
1175 | + if ($trash) { |
|
1176 | 1176 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1177 | 1177 | } else { |
1178 | 1178 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1179 | 1179 | } |
1180 | - EE_Error::add_success( $msg ); |
|
1180 | + EE_Error::add_success($msg); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1183 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1184 | 1184 | |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1197,19 +1197,19 @@ discard block |
||
1197 | 1197 | protected function _delete_price_type() { |
1198 | 1198 | |
1199 | 1199 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1200 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1200 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1201 | 1201 | |
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | //Checkboxes |
1206 | - if (!empty($this->_req_data['checkbox'])) { |
|
1206 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1207 | 1207 | // if array has more than one element than success message should be plural |
1208 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1208 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1209 | 1209 | $what = $PRT->item_name($success); |
1210 | 1210 | // cycle thru bulk action checkboxes |
1211 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1212 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1211 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1212 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1213 | 1213 | $success = 0; |
1214 | 1214 | } |
1215 | 1215 | } |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | - $query_args = array( 'action'=> 'price_types' ); |
|
1221 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1220 | + $query_args = array('action'=> 'price_types'); |
|
1221 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1222 | 1222 | |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * @return string |
1235 | 1235 | */ |
1236 | 1236 | protected function _learn_more_about_pricing_link() { |
1237 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1237 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
158 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -167,26 +167,26 @@ discard block |
||
167 | 167 | * @param string $template |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function template_include( $template ) { |
|
170 | + public function template_include($template) { |
|
171 | 171 | global $post; |
172 | 172 | /** @type EE_Event_Single_Config $config */ |
173 | 173 | $config = $this->config(); |
174 | - if ( $config->display_status_banner_single ) { |
|
175 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
174 | + if ($config->display_status_banner_single) { |
|
175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | 176 | } |
177 | 177 | // not a custom template? |
178 | 178 | if ( |
179 | 179 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
180 | - && ! post_password_required( $post ) |
|
180 | + && ! post_password_required($post) |
|
181 | 181 | ) { |
182 | 182 | EEH_Template::load_espresso_theme_functions(); |
183 | 183 | // then add extra event data via hooks |
184 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
185 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
186 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
187 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
184 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
185 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
186 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
187 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
188 | 188 | // don't display entry meta because the existing theme will take car of that |
189 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
189 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
190 | 190 | } |
191 | 191 | return $template; |
192 | 192 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @param array $wp_query_array an array containing the WP_Query object |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - public static function loop_start( $wp_query_array ) { |
|
203 | + public static function loop_start($wp_query_array) { |
|
204 | 204 | global $post; |
205 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
205 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param int $id |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public static function the_title( $title = '', $id = 0 ) { |
|
218 | + public static function the_title($title = '', $id = 0) { |
|
219 | 219 | global $post; |
220 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
220 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param string $excerpt |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
232 | + public static function get_the_excerpt($excerpt = '') { |
|
233 | 233 | EED_Event_Single::$using_get_the_excerpt = true; |
234 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
234 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
235 | 235 | return $excerpt; |
236 | 236 | } |
237 | 237 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $text |
245 | 245 | * @return string |
246 | 246 | */ |
247 | - public static function end_get_the_excerpt( $text = '' ) { |
|
247 | + public static function end_get_the_excerpt($text = '') { |
|
248 | 248 | EED_Event_Single::$using_get_the_excerpt = false; |
249 | 249 | return $text; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $content |
259 | 259 | * @return string |
260 | 260 | */ |
261 | - public static function event_details( $content ) { |
|
261 | + public static function event_details($content) { |
|
262 | 262 | global $post; |
263 | 263 | static $current_post_ID = 0; |
264 | 264 | if ( |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
274 | 274 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
275 | 275 | // so the following allows this filter to be applied multiple times, but only once for real |
276 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
277 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
276 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
277 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
278 | 278 | // we need to first remove this callback from being applied to the_content() |
279 | 279 | // (otherwise it will recurse and blow up the interweb) |
280 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
280 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
281 | 281 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
282 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
283 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
284 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
282 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
283 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
284 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
285 | 285 | } else { |
286 | 286 | $content = EED_Event_Single::use_filterable_display_order(); |
287 | 287 | } |
@@ -302,19 +302,19 @@ discard block |
||
302 | 302 | // it uses the_content() for displaying the $post->post_content |
303 | 303 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
304 | 304 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
305 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
305 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
306 | 306 | //now add additional content |
307 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
310 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
307 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
310 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
311 | 311 | // now load our template |
312 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
312 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
313 | 313 | //now add our filter back in, plus some others |
314 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
315 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
314 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
315 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
318 | 318 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
319 | 319 | return $content; |
320 | 320 | } |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @param string $content |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function event_datetimes( $content ) { |
|
332 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
331 | + public static function event_datetimes($content) { |
|
332 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param string $content |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - public static function event_tickets( $content ) { |
|
345 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
344 | + public static function event_tickets($content) { |
|
345 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param string $content |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public static function event_venue( $content ) { |
|
358 | - return EED_Event_Single::event_venues( $content ); |
|
357 | + public static function event_venue($content) { |
|
358 | + return EED_Event_Single::event_venues($content); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param string $content |
368 | 368 | * @return string |
369 | 369 | */ |
370 | - public static function event_venues( $content ) { |
|
371 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
370 | + public static function event_venues($content) { |
|
371 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @param array $wp_query_array an array containing the WP_Query object |
381 | 381 | * @return void |
382 | 382 | */ |
383 | - public static function loop_end( $wp_query_array ) { |
|
383 | + public static function loop_end($wp_query_array) { |
|
384 | 384 | global $post; |
385 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
385 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -395,18 +395,18 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function wp_enqueue_scripts() { |
397 | 397 | // get some style |
398 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
399 | - EE_Registry::instance()->load_helper( 'File' ); |
|
398 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
399 | + EE_Registry::instance()->load_helper('File'); |
|
400 | 400 | // first check uploads folder |
401 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
402 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
401 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
402 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
403 | 403 | } else { |
404 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
404 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } |
406 | - wp_enqueue_script( $this->theme ); |
|
407 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
408 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
409 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
406 | + wp_enqueue_script($this->theme); |
|
407 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
408 | + EE_Registry::instance()->load_helper('Maps'); |
|
409 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | * @return bool |
426 | 426 | */ |
427 | 427 | public static function display_venue() { |
428 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
428 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
429 | 429 | /** @type EE_Event_Single_Config $config */ |
430 | 430 | $config = EED_Event_Single::instance()->config(); |
431 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
431 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
432 | 432 | $venue_name = EEH_Venue_View::venue_name(); |
433 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
433 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Event Details |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /modules/event_details/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Event Details |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /modules/event_details/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EED_Event_Single extends EED_Module { |
25 | 25 | |
26 | 26 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Events_Archive |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
59 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
58 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
59 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public static function set_hooks_admin() { |
70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public static function set_definitions() { |
83 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
84 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
83 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
84 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return \EE_Events_Archive_Config |
93 | 93 | */ |
94 | - protected function set_config(){ |
|
95 | - $this->set_config_section( 'template_settings' ); |
|
96 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
97 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
94 | + protected function set_config() { |
|
95 | + $this->set_config_section('template_settings'); |
|
96 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
97 | + $this->set_config_name('EED_Events_Archive'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,35 +106,35 @@ discard block |
||
106 | 106 | * @param \EE_Events_Archive_Config $config |
107 | 107 | * @return \EE_Template_Part_Manager |
108 | 108 | */ |
109 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
109 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
110 | 110 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
111 | 111 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
112 | 112 | $template_parts = new EE_Template_Part_Manager(); |
113 | 113 | $template_parts->add_template_part( |
114 | 114 | 'tickets', |
115 | - __( 'Ticket Selector', 'event_espresso' ), |
|
115 | + __('Ticket Selector', 'event_espresso'), |
|
116 | 116 | 'content-espresso_events-tickets.php', |
117 | 117 | $config->display_order_tickets |
118 | 118 | ); |
119 | 119 | $template_parts->add_template_part( |
120 | 120 | 'datetimes', |
121 | - __( 'Dates and Times', 'event_espresso' ), |
|
121 | + __('Dates and Times', 'event_espresso'), |
|
122 | 122 | 'content-espresso_events-datetimes.php', |
123 | 123 | $config->display_order_datetimes |
124 | 124 | ); |
125 | 125 | $template_parts->add_template_part( |
126 | 126 | 'event', |
127 | - __( 'Event Description', 'event_espresso' ), |
|
127 | + __('Event Description', 'event_espresso'), |
|
128 | 128 | 'content-espresso_events-details.php', |
129 | 129 | $config->display_order_event |
130 | 130 | ); |
131 | 131 | $template_parts->add_template_part( |
132 | 132 | 'venue', |
133 | - __( 'Venue Information', 'event_espresso' ), |
|
133 | + __('Venue Information', 'event_espresso'), |
|
134 | 134 | 'content-espresso_events-venues.php', |
135 | 135 | $config->display_order_venue |
136 | 136 | ); |
137 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
137 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
138 | 138 | return $template_parts; |
139 | 139 | } |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
151 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
150 | + public function run($WP) { |
|
151 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
153 | 153 | $this->set_config(); |
154 | 154 | /** @type EE_Events_Archive_Config $config */ |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | // load other required components |
157 | 157 | $this->load_event_list_assets(); |
158 | 158 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
159 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
159 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
160 | 160 | //add query filters |
161 | 161 | EEH_Event_Query::add_query_filters(); |
162 | 162 | // set params that will get used by the filters |
163 | 163 | EEH_Event_Query::set_query_params( |
164 | - '', // month |
|
165 | - '', // category |
|
166 | - $config->display_expired_events, // show_expired |
|
167 | - 'start_date', // orderby |
|
164 | + '', // month |
|
165 | + '', // category |
|
166 | + $config->display_expired_events, // show_expired |
|
167 | + 'start_date', // orderby |
|
168 | 168 | 'ASC' // sort |
169 | 169 | ); |
170 | 170 | // check what template is loaded |
171 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
171 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -200,30 +200,30 @@ discard block |
||
200 | 200 | * @param string $template |
201 | 201 | * @return string |
202 | 202 | */ |
203 | - public function template_include( $template = '' ) { |
|
203 | + public function template_include($template = '') { |
|
204 | 204 | // don't add content filter for dedicated EE child themes or private posts |
205 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
206 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
205 | + EE_Registry::instance()->load_helper('Template'); |
|
206 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
207 | 207 | /** @type EE_Events_Archive_Config $config */ |
208 | 208 | $config = $this->config(); |
209 | 209 | // add status banner ? |
210 | - if ( $config->display_status_banner ) { |
|
211 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
210 | + if ($config->display_status_banner) { |
|
211 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
212 | 212 | } |
213 | 213 | // if NOT a custom template |
214 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
214 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
215 | 215 | // don't display entry meta because the existing theme will take care of that |
216 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
216 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
217 | 217 | // load functions.php file for the theme (loaded by WP if using child theme) |
218 | 218 | EEH_Template::load_espresso_theme_functions(); |
219 | 219 | // because we don't know if the theme is using the_excerpt() |
220 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
220 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
221 | 221 | // or the_content |
222 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
222 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
223 | 223 | // and just in case they are running get_the_excerpt() which DESTROYS things |
224 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
224 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
225 | 225 | // don't display entry meta because the existing theme will take care of that |
226 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
226 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | return $template; |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @param string $excerpt |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
242 | - if ( post_password_required() ) { |
|
241 | + public static function get_the_excerpt($excerpt = '') { |
|
242 | + if (post_password_required()) { |
|
243 | 243 | return $excerpt; |
244 | 244 | } |
245 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
246 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
247 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
248 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
245 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
246 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
247 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
248 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
249 | 249 | } else { |
250 | 250 | EED_Events_Archive::$using_get_the_excerpt = true; |
251 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
251 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
252 | 252 | } |
253 | 253 | return $excerpt; |
254 | 254 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param string $text |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public static function end_get_the_excerpt( $text = '' ) { |
|
265 | + public static function end_get_the_excerpt($text = '') { |
|
266 | 266 | EED_Events_Archive::$using_get_the_excerpt = false; |
267 | 267 | return $text; |
268 | 268 | } |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | * @param string $id |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - public static function the_title( $title = '', $id = '' ) { |
|
280 | + public static function the_title($title = '', $id = '') { |
|
281 | 281 | global $post; |
282 | - if ( $post instanceof WP_Post ) { |
|
283 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
282 | + if ($post instanceof WP_Post) { |
|
283 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
284 | 284 | } |
285 | 285 | return $title; |
286 | 286 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param string $content |
295 | 295 | * @return string |
296 | 296 | */ |
297 | - public static function event_details( $content ) { |
|
297 | + public static function event_details($content) { |
|
298 | 298 | global $post; |
299 | 299 | static $current_post_ID = 0; |
300 | 300 | if ( |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | && ! EED_Events_Archive::$using_get_the_excerpt |
304 | 304 | && ! post_password_required() |
305 | 305 | && ( |
306 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
307 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
306 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
307 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
308 | 308 | ) |
309 | 309 | ) { |
310 | 310 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
314 | 314 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
315 | 315 | // so the following allows this filter to be applied multiple times, but only once for real |
316 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
317 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
316 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
317 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
318 | 318 | $content = \EED_Events_Archive::use_sortable_display_order(); |
319 | 319 | } else { |
320 | 320 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -333,20 +333,20 @@ discard block |
||
333 | 333 | */ |
334 | 334 | protected static function use_sortable_display_order() { |
335 | 335 | // no further password checks required atm |
336 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
336 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
337 | 337 | // 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) |
338 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
339 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
340 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
338 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
339 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
340 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
341 | 341 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
342 | 342 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
343 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
344 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
343 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
344 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
345 | 345 | // re-add our main filters (or else the next event won't have them) |
346 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
347 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
348 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
349 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
346 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
347 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
348 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
349 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
350 | 350 | return $content; |
351 | 351 | } |
352 | 352 | |
@@ -361,22 +361,22 @@ discard block |
||
361 | 361 | protected static function use_filterable_display_order() { |
362 | 362 | // we need to first remove this callback from being applied to the_content() |
363 | 363 | // (otherwise it will recurse and blow up the interweb) |
364 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
365 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
366 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
364 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
365 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
366 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
367 | 367 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
368 | 368 | EED_Events_Archive::_add_additional_excerpt_filters(); |
369 | 369 | EED_Events_Archive::_add_additional_content_filters(); |
370 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
370 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
371 | 371 | // now load our template |
372 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
372 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
373 | 373 | // re-add our main filters (or else the next event won't have them) |
374 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
375 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
376 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
374 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
375 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
376 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
377 | 377 | // but remove the other filters so that they don't get applied to the next post |
378 | 378 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
379 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
379 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
380 | 380 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
381 | 381 | //return ! empty( $template ) ? $template : $content; |
382 | 382 | return $content; |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | * @param string $content |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - public static function event_datetimes( $content ) { |
|
395 | - if ( post_password_required() ) { |
|
394 | + public static function event_datetimes($content) { |
|
395 | + if (post_password_required()) { |
|
396 | 396 | return $content; |
397 | 397 | } |
398 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
398 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -405,11 +405,11 @@ discard block |
||
405 | 405 | * @param string $content |
406 | 406 | * @return string |
407 | 407 | */ |
408 | - public static function event_tickets( $content ) { |
|
409 | - if ( post_password_required() ) { |
|
408 | + public static function event_tickets($content) { |
|
409 | + if (post_password_required()) { |
|
410 | 410 | return $content; |
411 | 411 | } |
412 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
412 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | * @param string $content |
422 | 422 | * @return string |
423 | 423 | */ |
424 | - public static function event_venue( $content ) { |
|
425 | - return EED_Events_Archive::event_venues( $content ); |
|
424 | + public static function event_venue($content) { |
|
425 | + return EED_Events_Archive::event_venues($content); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | * @param string $content |
433 | 433 | * @return string |
434 | 434 | */ |
435 | - public static function event_venues( $content ) { |
|
436 | - if ( post_password_required() ) { |
|
435 | + public static function event_venues($content) { |
|
436 | + if (post_password_required()) { |
|
437 | 437 | return $content; |
438 | 438 | } |
439 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
439 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * @return void |
449 | 449 | */ |
450 | 450 | private static function _add_additional_excerpt_filters() { |
451 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
452 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
453 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
451 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
452 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
453 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | * @return void |
463 | 463 | */ |
464 | 464 | private static function _add_additional_content_filters() { |
465 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
466 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
467 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
465 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
466 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
467 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | * @return void |
477 | 477 | */ |
478 | 478 | private static function _remove_additional_events_archive_filters() { |
479 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
480 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
481 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
482 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
483 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
484 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
479 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
480 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
481 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
482 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
483 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
484 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | */ |
495 | 495 | public static function remove_all_events_archive_filters() { |
496 | 496 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
497 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
498 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
499 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
500 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
501 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
502 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
503 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
504 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
505 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
497 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
498 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
499 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
500 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
501 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
502 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
503 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
504 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
505 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
506 | 506 | // don't display entry meta because the existing theme will take care of that |
507 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
507 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -519,15 +519,15 @@ discard block |
||
519 | 519 | * @return void |
520 | 520 | */ |
521 | 521 | public function load_event_list_assets() { |
522 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
523 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
524 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
525 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
526 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
527 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
528 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
522 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
523 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
524 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
525 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
526 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
527 | + EE_Registry::instance()->load_helper('Maps'); |
|
528 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
529 | 529 | } |
530 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
530 | + EE_Registry::instance()->load_helper('Event_View'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | */ |
544 | 544 | public function wp_enqueue_scripts() { |
545 | 545 | // get some style |
546 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
546 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
547 | 547 | // first check uploads folder |
548 | - EE_Registry::instance()->load_helper( 'File' ); |
|
549 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
550 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
548 | + EE_Registry::instance()->load_helper('File'); |
|
549 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
550 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
551 | 551 | } else { |
552 | 552 | } |
553 | - wp_enqueue_style( $this->theme ); |
|
553 | + wp_enqueue_style($this->theme); |
|
554 | 554 | |
555 | 555 | } |
556 | 556 | } |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | */ |
569 | 569 | public static function template_settings_form() { |
570 | 570 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
571 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
572 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
571 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
572 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
573 | 573 | $events_archive_settings = array( |
574 | 574 | 'display_status_banner' => 0, |
575 | 575 | 'display_description' => 1, |
@@ -578,8 +578,8 @@ discard block |
||
578 | 578 | 'display_venue' => 0, |
579 | 579 | 'display_expired_events' => 0 |
580 | 580 | ); |
581 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
582 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
581 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
582 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -595,16 +595,16 @@ discard block |
||
595 | 595 | * @param EE_Request_Handler $REQ |
596 | 596 | * @return EE_Template_Config |
597 | 597 | */ |
598 | - public static function update_template_settings( $CFG, $REQ ) { |
|
598 | + public static function update_template_settings($CFG, $REQ) { |
|
599 | 599 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
600 | 600 | // unless we are resetting the config... |
601 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
602 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
603 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
604 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
605 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
606 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
607 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
601 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
602 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
603 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
604 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
605 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
606 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
607 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
608 | 608 | return $CFG; |
609 | 609 | } |
610 | 610 | |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @param string $extra_class |
618 | 618 | * @return string |
619 | 619 | */ |
620 | - public static function event_list_css( $extra_class = '' ) { |
|
621 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
620 | + public static function event_list_css($extra_class = '') { |
|
621 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
622 | 622 | $event_list_css[] = 'espresso-event-list-event'; |
623 | - return implode( ' ', $event_list_css ); |
|
623 | + return implode(' ', $event_list_css); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | * @param $value |
648 | 648 | * @return bool |
649 | 649 | */ |
650 | - public static function display_description( $value ) { |
|
650 | + public static function display_description($value) { |
|
651 | 651 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
652 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
652 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
653 | 653 | return $display_description === $value ? TRUE : FALSE; |
654 | 654 | } |
655 | 655 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | */ |
663 | 663 | public static function display_ticket_selector() { |
664 | 664 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
665 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
665 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @return bool |
675 | 675 | */ |
676 | 676 | public static function display_venue() { |
677 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
677 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
678 | 678 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
679 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
679 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public static function display_datetimes() { |
690 | 690 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
691 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
691 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * @return string |
704 | 704 | */ |
705 | 705 | public static function event_list_title() { |
706 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
706 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | /** |
713 | 713 | * @since 4.4.0 |
714 | 714 | */ |
715 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
715 | + public static function _doing_it_wrong_notice($function = '') { |
|
716 | 716 | EE_Error::doing_it_wrong( |
717 | 717 | __FUNCTION__, |
718 | 718 | sprintf( |
719 | - __( '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' ), |
|
719 | + __('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'), |
|
720 | 720 | $function, |
721 | 721 | '<br />', |
722 | 722 | '4.6.0' |
@@ -732,107 +732,107 @@ discard block |
||
732 | 732 | * @since 4.4.0 |
733 | 733 | */ |
734 | 734 | public function get_post_data() { |
735 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
735 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
736 | 736 | EEH_Event_Query::set_query_params(); |
737 | 737 | } |
738 | 738 | /** |
739 | 739 | * @deprecated |
740 | 740 | * @since 4.4.0 |
741 | 741 | */ |
742 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
743 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
744 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
745 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
742 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
743 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
744 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
745 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
746 | 746 | } |
747 | 747 | /** |
748 | 748 | * @deprecated |
749 | 749 | * @since 4.4.0 |
750 | 750 | */ |
751 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
752 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
753 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
754 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
751 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
752 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
753 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
754 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
755 | 755 | } |
756 | 756 | /** |
757 | 757 | * @deprecated |
758 | 758 | * @since 4.4.0 |
759 | 759 | */ |
760 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
761 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
762 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
763 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
760 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
761 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
762 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
763 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
764 | 764 | } |
765 | 765 | /** |
766 | 766 | * @deprecated |
767 | 767 | * @since 4.4.0 |
768 | 768 | */ |
769 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
770 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
771 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
772 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
769 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
770 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
771 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
772 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
773 | 773 | } |
774 | 774 | /** |
775 | 775 | * @deprecated |
776 | 776 | * @since 4.4.0 |
777 | 777 | */ |
778 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
779 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
780 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
781 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
778 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
779 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
780 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
781 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
782 | 782 | } |
783 | 783 | /** |
784 | 784 | * @deprecated |
785 | 785 | * @since 4.4.0 |
786 | 786 | */ |
787 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
788 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
789 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
790 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
787 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
788 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
789 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
790 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
791 | 791 | } |
792 | 792 | /** |
793 | 793 | * @deprecated |
794 | 794 | * @since 4.4.0 |
795 | 795 | */ |
796 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
797 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
798 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
799 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
796 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
797 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
798 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
799 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
800 | 800 | } |
801 | 801 | /** |
802 | 802 | * @deprecated |
803 | 803 | * @since 4.4.0 |
804 | 804 | */ |
805 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
806 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
807 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
808 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
805 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
806 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
807 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
808 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
809 | 809 | } |
810 | 810 | /** |
811 | 811 | * @deprecated |
812 | 812 | * @since 4.4.0 |
813 | 813 | */ |
814 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
815 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
816 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
817 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
814 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
815 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
816 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
817 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
818 | 818 | } |
819 | 819 | /** |
820 | 820 | * @deprecated |
821 | 821 | * @since 4.4.0 |
822 | 822 | */ |
823 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
824 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
825 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
826 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
823 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
824 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
825 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
826 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
827 | 827 | } |
828 | 828 | /** |
829 | 829 | * @deprecated |
830 | 830 | * @since 4.4.0 |
831 | 831 | */ |
832 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
833 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
834 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
835 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
832 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
833 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
834 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
835 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -863,8 +863,8 @@ discard block |
||
863 | 863 | * @param string $extra_class |
864 | 864 | * @return string |
865 | 865 | */ |
866 | -function espresso_event_list_css( $extra_class = '' ) { |
|
867 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
866 | +function espresso_event_list_css($extra_class = '') { |
|
867 | + return EED_Events_Archive::event_list_css($extra_class); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -878,14 +878,14 @@ discard block |
||
878 | 878 | * @return bool |
879 | 879 | */ |
880 | 880 | function espresso_display_full_description_in_event_list() { |
881 | - return EED_Events_Archive::display_description( 2 ); |
|
881 | + return EED_Events_Archive::display_description(2); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
885 | 885 | * @return bool |
886 | 886 | */ |
887 | 887 | function espresso_display_excerpt_in_event_list() { |
888 | - return EED_Events_Archive::display_description( 1 ); |
|
888 | + return EED_Events_Archive::display_description(1); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Transaction Model |
@@ -68,36 +68,36 @@ discard block |
||
68 | 68 | * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
69 | 69 | * @return EEM_Transaction |
70 | 70 | */ |
71 | - protected function __construct( $timezone ) { |
|
72 | - $this->singular_item = __('Transaction','event_espresso'); |
|
73 | - $this->plural_item = __('Transactions','event_espresso'); |
|
71 | + protected function __construct($timezone) { |
|
72 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
73 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
74 | 74 | |
75 | 75 | $this->_tables = array( |
76 | - 'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID') |
|
76 | + 'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
77 | 77 | ); |
78 | 78 | $this->_fields = array( |
79 | 79 | 'Transaction'=>array( |
80 | - 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')), |
|
81 | - 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ), |
|
82 | - 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0), |
|
83 | - 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0), |
|
84 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
85 | - 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''), |
|
86 | - 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''), |
|
80 | + 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
81 | + 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone), |
|
82 | + 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0), |
|
83 | + 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
84 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
85 | + 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''), |
|
86 | + 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
87 | 87 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'), |
88 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ), |
|
88 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()), |
|
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | $this->_model_relations = array( |
92 | 92 | 'Registration'=>new EE_Has_Many_Relation(), |
93 | 93 | 'Payment'=>new EE_Has_Many_Relation(), |
94 | 94 | 'Status'=>new EE_Belongs_To_Relation(), |
95 | - 'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items |
|
95 | + 'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items |
|
96 | 96 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
97 | 97 | 'Message' => new EE_Has_Many_Relation() |
98 | 98 | ); |
99 | 99 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
100 | - parent::__construct( $timezone ); |
|
100 | + parent::__construct($timezone); |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | * @param string $period |
109 | 109 | * @return \stdClass[] |
110 | 110 | */ |
111 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
111 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
112 | 112 | |
113 | - $sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
|
113 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
114 | 114 | $results = $this->_get_all_wpdb_results( |
115 | 115 | array( |
116 | 116 | array( |
117 | 117 | 'TXN_timestamp' => array('>=', $sql_date)), |
118 | 118 | 'group_by' => 'txnDate', |
119 | - 'order_by' => array('TXN_timestamp' => 'DESC' ) |
|
119 | + 'order_by' => array('TXN_timestamp' => 'DESC') |
|
120 | 120 | ), |
121 | 121 | OBJECT, |
122 | 122 | array( |
123 | - 'txnDate' => array('DATE(Transaction.TXN_timestamp)','%s'), |
|
123 | + 'txnDate' => array('DATE(Transaction.TXN_timestamp)', '%s'), |
|
124 | 124 | 'revenue' => array('SUM(Transaction.TXN_paid)', '%d') |
125 | 125 | )); |
126 | 126 | return $results; |
@@ -136,22 +136,22 @@ discard block |
||
136 | 136 | * @throws \EE_Error |
137 | 137 | * @return mixed |
138 | 138 | */ |
139 | - public function get_revenue_per_event_report( $period = 'month' ) { |
|
139 | + public function get_revenue_per_event_report($period = 'month') { |
|
140 | 140 | /** @type WPDB $wpdb */ |
141 | 141 | global $wpdb; |
142 | - $date_mod = strtotime( '-1 ' . $period ); |
|
142 | + $date_mod = strtotime('-1 '.$period); |
|
143 | 143 | |
144 | 144 | $SQL = 'SELECT post_title as event_name, SUM(TXN_paid) AS revenue'; |
145 | - $SQL .= ' FROM ' . $this->_get_main_table()->get_table_name() . ' txn'; |
|
146 | - $SQL .= ' LEFT JOIN ' . $wpdb->prefix . 'esp_registration reg ON reg.TXN_ID = txn.TXN_ID'; |
|
147 | - $SQL .= ' LEFT JOIN ' . $wpdb->posts . ' evt ON evt.ID = reg.EVT_ID'; |
|
145 | + $SQL .= ' FROM '.$this->_get_main_table()->get_table_name().' txn'; |
|
146 | + $SQL .= ' LEFT JOIN '.$wpdb->prefix.'esp_registration reg ON reg.TXN_ID = txn.TXN_ID'; |
|
147 | + $SQL .= ' LEFT JOIN '.$wpdb->posts.' evt ON evt.ID = reg.EVT_ID'; |
|
148 | 148 | $SQL .= ' WHERE REG_count = 1'; |
149 | 149 | $SQL .= ' AND REG_date >= %d'; |
150 | 150 | $SQL .= ' GROUP BY event_name'; |
151 | 151 | $SQL .= ' ORDER BY event_name'; |
152 | 152 | $SQL .= ' LIMIT 0, 24'; |
153 | 153 | |
154 | - return $this->_do_wpdb_query( 'get_results', array( $wpdb->prepare( $SQL, $date_mod ) ) ); |
|
154 | + return $this->_do_wpdb_query('get_results', array($wpdb->prepare($SQL, $date_mod))); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @param string $reg_url_link |
168 | 168 | * @return EE_Transaction |
169 | 169 | */ |
170 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
171 | - return $this->get_one( array( |
|
170 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
171 | + return $this->get_one(array( |
|
172 | 172 | array( |
173 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
173 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
174 | 174 | ) |
175 | 175 | )); |
176 | 176 | } |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | * @param boolean $save_txn whether or not to save the transaction during this function call |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
193 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
194 | 194 | EE_Error::doing_it_wrong( |
195 | - __CLASS__ . '::' . __FUNCTION__, |
|
196 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
195 | + __CLASS__.'::'.__FUNCTION__, |
|
196 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
197 | 197 | '4.6.0' |
198 | 198 | ); |
199 | 199 | /** @type EE_Transaction_Processor $transaction_processor */ |
200 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
201 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id )); |
|
200 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
201 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id)); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | array( |
230 | 230 | 0 => array( |
231 | 231 | 'STS_ID' => EEM_Transaction::failed_status_code, |
232 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
232 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
233 | 233 | ) |
234 | 234 | ), |
235 | 235 | $time_to_leave_alone |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | */ |
243 | 243 | $txn_ids = apply_filters( |
244 | 244 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
245 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
245 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
246 | 246 | $time_to_leave_alone |
247 | 247 | ); |
248 | 248 | |
249 | 249 | //now that we have the ids to delete, let's get deletin' |
250 | 250 | //Why no wpdb->prepare? Because the data is trusted. We got the ids from the original query to get them FROM |
251 | 251 | //the db (which is sanitized) so no need to prepare them again. |
252 | - if ( $txn_ids ) { |
|
253 | - $query = ' |
|
252 | + if ($txn_ids) { |
|
253 | + $query = ' |
|
254 | 254 | DELETE |
255 | - FROM ' . $this->table() . ' |
|
255 | + FROM ' . $this->table().' |
|
256 | 256 | WHERE |
257 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
258 | - $deleted = $wpdb->query( $query ); |
|
257 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
258 | + $deleted = $wpdb->query($query); |
|
259 | 259 | } |
260 | - if ( $deleted ) { |
|
260 | + if ($deleted) { |
|
261 | 261 | /** |
262 | 262 | * Allows code to do something after the transactions have been deleted. |
263 | 263 | */ |
264 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
264 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
265 | 265 | } |
266 | 266 | return $deleted; |
267 | 267 | } |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * Field to only allow tags that are normally allowed on post_content: |
4 | 4 | * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
5 | 5 | */ |
6 | -class EE_Post_Content_Field extends EE_Full_HTML_Field{ |
|
6 | +class EE_Post_Content_Field extends EE_Full_HTML_Field { |
|
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
9 | 9 | * @param string $value_inputted_for_field_on_model_object |
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' )); |
|
13 | + $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post')); |
|
14 | 14 | return parent::prepare_for_set($value_with_select_tags); |
15 | 15 | } |
16 | 16 | |
17 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
17 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
18 | 18 | return $value_found_in_db_for_model_object; |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
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 | * Class EE_Line_Item_Filter_Collection |