@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * Class EE_Email_Validation_Strategy |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage core |
|
7 | - * @author Mike Nelson |
|
8 | - * @since 4.6 |
|
9 | - * |
|
10 | - */ |
|
3 | + * Class EE_Email_Validation_Strategy |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage core |
|
7 | + * @author Mike Nelson |
|
8 | + * @since 4.6 |
|
9 | + * |
|
10 | + */ |
|
11 | 11 | class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
12 | 12 | |
13 | 13 | /** |
14 | - * @param null $validation_error_message |
|
15 | - */ |
|
14 | + * @param null $validation_error_message |
|
15 | + */ |
|
16 | 16 | public function __construct( $validation_error_message = NULL ) { |
17 | 17 | if( ! $validation_error_message ){ |
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | - * @return array |
|
42 | - */ |
|
41 | + * @return array |
|
42 | + */ |
|
43 | 43 | function get_jquery_validation_rule_array(){ |
44 | 44 | return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
45 | 45 | } |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy{ |
|
11 | +class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null $validation_error_message |
15 | 15 | */ |
16 | - public function __construct( $validation_error_message = NULL ) { |
|
17 | - if( ! $validation_error_message ){ |
|
16 | + public function __construct($validation_error_message = NULL) { |
|
17 | + if ( ! $validation_error_message) { |
|
18 | 18 | $validation_error_message = __("Please enter a valid email address.", "event_espresso"); |
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * @return bool |
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | - function validate( $normalized_value ) { |
|
33 | - if( $normalized_value && ! $this->_validate_email( $normalized_value ) ){ |
|
34 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
32 | + function validate($normalized_value) { |
|
33 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
34 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return array |
42 | 42 | */ |
43 | - function get_jquery_validation_rule_array(){ |
|
44 | - return array( 'email'=>true, 'messages' => array( 'email' => $this->get_validation_error_message() ) ); |
|
43 | + function get_jquery_validation_rule_array() { |
|
44 | + return array('email'=>true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -54,29 +54,29 @@ discard block |
||
54 | 54 | * @return bool of whether the email is valid or not |
55 | 55 | * @throws \EE_Validation_Error |
56 | 56 | */ |
57 | - private function _validate_email( $email ) { |
|
58 | - if ( ! preg_match( '/^.+\@\S+\.\S+$/', $email ) ) { |
|
57 | + private function _validate_email($email) { |
|
58 | + if ( ! preg_match('/^.+\@\S+\.\S+$/', $email)) { |
|
59 | 59 | // email not in correct {string}@{string}.{string} format |
60 | 60 | return false; |
61 | 61 | } else { |
62 | - $atIndex = strrpos( $email, "@" ); |
|
63 | - $domain = substr( $email, $atIndex + 1 ); |
|
64 | - $local = substr( $email, 0, $atIndex ); |
|
65 | - $localLen = strlen( $local ); |
|
66 | - $domainLen = strlen( $domain ); |
|
67 | - if ( $localLen < 1 || $localLen > 64 ) { |
|
62 | + $atIndex = strrpos($email, "@"); |
|
63 | + $domain = substr($email, $atIndex + 1); |
|
64 | + $local = substr($email, 0, $atIndex); |
|
65 | + $localLen = strlen($local); |
|
66 | + $domainLen = strlen($domain); |
|
67 | + if ($localLen < 1 || $localLen > 64) { |
|
68 | 68 | // local part length exceeded |
69 | 69 | return false; |
70 | - } else if ( $domainLen < 1 || $domainLen > 255 ) { |
|
70 | + } else if ($domainLen < 1 || $domainLen > 255) { |
|
71 | 71 | // domain part length exceeded |
72 | 72 | return false; |
73 | - } else if ( $local[ 0 ] == '.' || $local[ $localLen - 1 ] == '.' ) { |
|
73 | + } else if ($local[0] == '.' || $local[$localLen - 1] == '.') { |
|
74 | 74 | // local part starts or ends with '.' |
75 | 75 | return false; |
76 | - } else if ( preg_match( '/\\.\\./', $local ) ) { |
|
76 | + } else if (preg_match('/\\.\\./', $local)) { |
|
77 | 77 | // local part has two consecutive dots |
78 | 78 | return false; |
79 | - } else if ( preg_match( '/\\.\\./', $domain ) ) { |
|
79 | + } else if (preg_match('/\\.\\./', $domain)) { |
|
80 | 80 | // domain part has two consecutive dots |
81 | 81 | return false; |
82 | 82 | } else if ( |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | ) |
88 | 88 | ) { |
89 | 89 | return false; |
90 | - } else if ( apply_filters( 'FHEE__EE_Email_Validation_Strategy___validate_email__perform_dns_checks', false ) ) { |
|
91 | - if ( ! checkdnsrr( $domain, "MX" ) ) { |
|
90 | + } else if (apply_filters('FHEE__EE_Email_Validation_Strategy___validate_email__perform_dns_checks', false)) { |
|
91 | + if ( ! checkdnsrr($domain, "MX")) { |
|
92 | 92 | // domain not found in MX records |
93 | 93 | throw new EE_Validation_Error( |
94 | 94 | __( |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'event_espresso' |
97 | 97 | ) |
98 | 98 | ); |
99 | - } else if ( ! checkdnsrr( $domain, "A" ) ) { |
|
99 | + } else if ( ! checkdnsrr($domain, "A")) { |
|
100 | 100 | // domain not found in A records |
101 | 101 | throw new EE_Validation_Error( |
102 | 102 | __( |
@@ -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,20 +37,20 @@ discard block |
||
37 | 37 | protected $_reports_template_data = array(); |
38 | 38 | |
39 | 39 | |
40 | - public function __construct( $routing = TRUE ) { |
|
41 | - parent::__construct( $routing ); |
|
42 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
43 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
44 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
40 | + public function __construct($routing = TRUE) { |
|
41 | + parent::__construct($routing); |
|
42 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
43 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
44 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | protected function _extend_page_config() { |
49 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
49 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
50 | 50 | |
51 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
52 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
|
53 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
51 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
52 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0; |
|
53 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
54 | 54 | |
55 | 55 | $new_page_routes = array( |
56 | 56 | 'reports' => array( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | |
92 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
92 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
93 | 93 | |
94 | 94 | $new_page_config = array( |
95 | 95 | 'reports' => array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | 'filename' => 'registrations_event_checkin_other' |
135 | 135 | ) |
136 | 136 | ), |
137 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
138 | - 'qtips' => array('Registration_List_Table_Tips' ), |
|
137 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
138 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
139 | 139 | 'list_table' => 'EE_Event_Registrations_List_Table', |
140 | 140 | 'metaboxes' => array(), |
141 | 141 | 'require_nonce' => FALSE |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // var_dump($this->_req_data); |
157 | 157 | // exit(); |
158 | 158 | |
159 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
159 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
160 | 160 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
161 | 161 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
162 | 162 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | protected function _ajax_hooks() { |
167 | 167 | parent::_ajax_hooks(); |
168 | - add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') ); |
|
168 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -175,20 +175,20 @@ discard block |
||
175 | 175 | |
176 | 176 | //if newsletter message type is active then let's add filter and load js for it. |
177 | 177 | EE_Registry::instance()->load_helper('MSG_Template'); |
178 | - if ( EEH_MSG_Template::is_mt_active('newsletter') ) { |
|
178 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
179 | 179 | //enqueue newsletter js |
180 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
181 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION ); |
|
180 | + wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); |
|
181 | + wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); |
|
182 | 182 | //hook in buttons for newsletter message type trigger. |
183 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); |
|
183 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | 189 | public function load_scripts_styles_reports() { |
190 | - wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true ); |
|
191 | - wp_enqueue_script( 'ee-reg-reports-js' ); |
|
190 | + wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true); |
|
191 | + wp_enqueue_script('ee-reg-reports-js'); |
|
192 | 192 | $this->_registration_reports_js_setup(); |
193 | 193 | } |
194 | 194 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'slug' => 'all', |
221 | 221 | 'label' => __('All', 'event_espresso'), |
222 | 222 | 'count' => 0, |
223 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array( |
|
223 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array( |
|
224 | 224 | 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
225 | 225 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
226 | 226 | ) |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | 'slug' => 'all', |
239 | 239 | 'label' => __('All', 'event_espresso'), |
240 | 240 | 'count' => 0, |
241 | - 'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) |
|
241 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) |
|
242 | 242 | ), |
243 | 243 | ); |
244 | 244 | } |
@@ -254,20 +254,20 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function get_newsletter_form_content() { |
256 | 256 | //do a nonce check cause we're not coming in from an normal route here. |
257 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : ''; |
|
257 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : ''; |
|
258 | 258 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
259 | 259 | |
260 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
260 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
261 | 261 | //let's get the mtp for the incoming MTP_ ID |
262 | - if ( !isset( $this->_req_data['GRP_ID'] ) ) { |
|
263 | - EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
262 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
263 | + EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
264 | 264 | $this->_template_args['success'] = FALSE; |
265 | 265 | $this->_template_args['error'] = TRUE; |
266 | 266 | $this->_return_json(); |
267 | 267 | } |
268 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
269 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
270 | - EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
268 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
269 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
270 | + EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); |
|
271 | 271 | $this->_template_args['success'] = FALSE; |
272 | 272 | $this->_template_args['error'] = TRUE; |
273 | 273 | $this->_return_json(); |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | $MTPs = $MTPG->context_templates(); |
277 | 277 | $MTPs = $MTPs['attendee']; |
278 | 278 | $template_fields = array(); |
279 | - foreach ( $MTPs as $MTP ) { |
|
279 | + foreach ($MTPs as $MTP) { |
|
280 | 280 | $field = $MTP->get('MTP_template_field'); |
281 | - if ( $field == 'content' ) { |
|
281 | + if ($field == 'content') { |
|
282 | 282 | $content = $MTP->get('MTP_content'); |
283 | - if ( !empty( $content['newsletter_content'] ) ) { |
|
283 | + if ( ! empty($content['newsletter_content'])) { |
|
284 | 284 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
285 | 285 | } |
286 | 286 | continue; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $this->_template_args['data'] = array( |
294 | 294 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '', |
295 | 295 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '', |
296 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : '' |
|
296 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : '' |
|
297 | 297 | ); |
298 | 298 | $this->_return_json(); |
299 | 299 | } |
@@ -309,8 +309,8 @@ discard block |
||
309 | 309 | * @param EE_Admin_List_Table $list_table |
310 | 310 | * @return string html string for extra buttons |
311 | 311 | */ |
312 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
313 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { |
|
312 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
313 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { |
|
314 | 314 | return ''; |
315 | 315 | } |
316 | 316 | |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | 'event_registrations', |
320 | 320 | 'default' |
321 | 321 | ); |
322 | - if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
323 | - if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { |
|
322 | + if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
323 | + if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { |
|
324 | 324 | echo ''; |
325 | 325 | } else { |
326 | - $button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); |
|
327 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>'; |
|
328 | - add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); |
|
326 | + $button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); |
|
327 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>'; |
|
328 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | } |
@@ -337,38 +337,38 @@ discard block |
||
337 | 337 | $list_table = $this->_list_table_object; |
338 | 338 | $codes = array(); |
339 | 339 | //need to templates for the newsletter message type for the template selector. |
340 | - $values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); |
|
341 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) ); |
|
342 | - foreach ( $mtps as $mtp ) { |
|
340 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
341 | + $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); |
|
342 | + foreach ($mtps as $mtp) { |
|
343 | 343 | $name = $mtp->name(); |
344 | 344 | $values[] = array( |
345 | - 'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, |
|
345 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
346 | 346 | 'id' => $mtp->ID() |
347 | 347 | ); |
348 | 348 | } |
349 | 349 | |
350 | 350 | //need to get a list of shortcodes that are available for the newsletter message type. |
351 | 351 | EE_Registry::instance()->load_helper('MSG_Template'); |
352 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE ); |
|
353 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
354 | - $codes[$field] = implode(', ', array_keys($shortcode_array ) ); |
|
352 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); |
|
353 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
354 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $shortcodes = $codes; |
358 | 358 | |
359 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
359 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
360 | 360 | $form_template_args = array( |
361 | 361 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
362 | 362 | 'form_route' => 'newsletter_selected_send', |
363 | 363 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
364 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
364 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
365 | 365 | 'redirect_back_to' => $this->_req_action, |
366 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'), |
|
367 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), |
|
366 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
367 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
368 | 368 | 'shortcodes' => $shortcodes, |
369 | 369 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration' |
370 | 370 | ); |
371 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
371 | + EEH_Template::display_template($form_template, $form_template_args); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -383,35 +383,35 @@ discard block |
||
383 | 383 | protected function _newsletter_selected_send() { |
384 | 384 | $success = TRUE; |
385 | 385 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
386 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
387 | - EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
386 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
387 | + EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
388 | 388 | $success = FALSE; |
389 | 389 | } |
390 | 390 | |
391 | - if ( $success ) { |
|
391 | + if ($success) { |
|
392 | 392 | //update Message template in case there are any changes |
393 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] ); |
|
393 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']); |
|
394 | 394 | $MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array(); |
395 | - if ( empty( $MTPs ) ) { |
|
396 | - EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
395 | + if (empty($MTPs)) { |
|
396 | + EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
397 | 397 | $success = FALSE; |
398 | 398 | } |
399 | 399 | |
400 | 400 | //let's just update the specific fields |
401 | - foreach ( $MTPs['attendee'] as $MTP ) { |
|
401 | + foreach ($MTPs['attendee'] as $MTP) { |
|
402 | 402 | $field = $MTP->get('MTP_template_field'); |
403 | 403 | $content = $MTP->get('MTP_content'); |
404 | 404 | $new_content = $content; |
405 | - switch( $field ) { |
|
405 | + switch ($field) { |
|
406 | 406 | case 'from' : |
407 | - $new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content; |
|
407 | + $new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content; |
|
408 | 408 | break; |
409 | 409 | case 'subject' : |
410 | - $new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content; |
|
410 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content; |
|
411 | 411 | break; |
412 | 412 | case 'content' : |
413 | 413 | $new_content = $content; |
414 | - $new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content']; |
|
414 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content']; |
|
415 | 415 | break; |
416 | 416 | default : |
417 | 417 | continue; |
@@ -422,20 +422,20 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
425 | - $id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration'; |
|
425 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration'; |
|
426 | 426 | |
427 | 427 | //id_type will affect how we assemble the ids. |
428 | - $ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array(); |
|
428 | + $ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array(); |
|
429 | 429 | |
430 | - $contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); |
|
430 | + $contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
431 | 431 | |
432 | 432 | //we do _action because ALL triggers are handled in EED_Messages. |
433 | - do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() ); |
|
433 | + do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID()); |
|
434 | 434 | } |
435 | 435 | $query_args = array( |
436 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default' |
|
436 | + 'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default' |
|
437 | 437 | ); |
438 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
438 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | * @return void |
458 | 458 | */ |
459 | 459 | protected function _registration_reports() { |
460 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
461 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true ); |
|
460 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
461 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true); |
|
462 | 462 | // the final template wrapper |
463 | 463 | $this->display_admin_page_with_no_sidebar(); |
464 | 464 | |
@@ -471,29 +471,29 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @return string |
473 | 473 | */ |
474 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
474 | + private function _registrations_per_day_report($period = '-1 month') { |
|
475 | 475 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
476 | 476 | |
477 | - $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period ); |
|
478 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
477 | + $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
478 | + EE_Registry::instance()->load_helper('Template'); |
|
479 | 479 | |
480 | 480 | $results = (array) $results; |
481 | 481 | $regs = array(); |
482 | 482 | $subtitle = ''; |
483 | 483 | |
484 | - if( $results ) { |
|
484 | + if ($results) { |
|
485 | 485 | $column_titles = array(); |
486 | 486 | $tracker = 0; |
487 | - foreach ( $results as $result ) { |
|
487 | + foreach ($results as $result) { |
|
488 | 488 | $report_column_values = array(); |
489 | - foreach( $result as $property_name => $property_value ) { |
|
489 | + foreach ($result as $property_name => $property_value) { |
|
490 | 490 | $property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value; |
491 | 491 | $report_column_values[] = $property_value; |
492 | - if ( $tracker === 0 ) { |
|
493 | - if ( $property_name == 'Registration_REG_date' ) { |
|
494 | - $column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' ); |
|
492 | + if ($tracker === 0) { |
|
493 | + if ($property_name == 'Registration_REG_date') { |
|
494 | + $column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso'); |
|
495 | 495 | } else { |
496 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
496 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
@@ -502,37 +502,37 @@ discard block |
||
502 | 502 | } |
503 | 503 | |
504 | 504 | //make sure the column_titles is pushed to the beginning of the array |
505 | - array_unshift( $regs, $column_titles ); |
|
505 | + array_unshift($regs, $column_titles); |
|
506 | 506 | //setup the date range. |
507 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
508 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
509 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
510 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
507 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
508 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
509 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
510 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
511 | 511 | $subtitle = sprintf( |
512 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
513 | - $beginning_date->format( 'Y-m-d' ), |
|
514 | - $ending_date->format( 'Y-m-d' ) |
|
512 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
513 | + $beginning_date->format('Y-m-d'), |
|
514 | + $ending_date->format('Y-m-d') |
|
515 | 515 | ); |
516 | 516 | } |
517 | 517 | |
518 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
518 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
519 | 519 | |
520 | 520 | $report_params = array( |
521 | 521 | 'title' => $report_title, |
522 | 522 | 'subtitle' => $subtitle, |
523 | 523 | 'id' => $report_ID, |
524 | 524 | 'regs' => $regs, |
525 | - 'noResults' => empty( $regs ), |
|
525 | + 'noResults' => empty($regs), |
|
526 | 526 | 'noRegsMsg' => sprintf( |
527 | 527 | __( |
528 | 528 | '%sThere are currently no registration records in the last month for this report.%s', |
529 | 529 | 'event_espresso' |
530 | 530 | ), |
531 | - '<h2>' . $report_title . '</h2><p>', |
|
531 | + '<h2>'.$report_title.'</h2><p>', |
|
532 | 532 | '</p>' |
533 | 533 | ), |
534 | 534 | ); |
535 | - wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params ); |
|
535 | + wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
536 | 536 | |
537 | 537 | return $report_ID; |
538 | 538 | } |
@@ -544,30 +544,30 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return string |
546 | 546 | */ |
547 | - private function _registrations_per_event_report( $period = '-1 month' ) { |
|
547 | + private function _registrations_per_event_report($period = '-1 month') { |
|
548 | 548 | |
549 | 549 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
550 | 550 | |
551 | - $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period ); |
|
552 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
551 | + $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
552 | + EE_Registry::instance()->load_helper('Template'); |
|
553 | 553 | |
554 | 554 | $results = (array) $results; |
555 | 555 | $regs = array(); |
556 | 556 | $subtitle = ''; |
557 | 557 | |
558 | - if ( $results ) { |
|
558 | + if ($results) { |
|
559 | 559 | $column_titles = array(); |
560 | 560 | $tracker = 0; |
561 | - foreach ( $results as $result ) { |
|
561 | + foreach ($results as $result) { |
|
562 | 562 | $report_column_values = array(); |
563 | - foreach( $result as $property_name => $property_value ) { |
|
564 | - $property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value; |
|
563 | + foreach ($result as $property_name => $property_value) { |
|
564 | + $property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value; |
|
565 | 565 | $report_column_values[] = $property_value; |
566 | - if ( $tracker === 0 ) { |
|
567 | - if ( $property_name == 'Registration_Event' ) { |
|
568 | - $column_titles[] = __( 'Event', 'event_espresso' ); |
|
566 | + if ($tracker === 0) { |
|
567 | + if ($property_name == 'Registration_Event') { |
|
568 | + $column_titles[] = __('Event', 'event_espresso'); |
|
569 | 569 | } else { |
570 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
570 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | } |
@@ -576,38 +576,38 @@ discard block |
||
576 | 576 | } |
577 | 577 | |
578 | 578 | //make sure the column_titles is pushed to the beginning of the array |
579 | - array_unshift( $regs, $column_titles ); |
|
579 | + array_unshift($regs, $column_titles); |
|
580 | 580 | |
581 | 581 | //setup the date range. |
582 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
583 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
584 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
585 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
582 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
583 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
584 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
585 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
586 | 586 | $subtitle = sprintf( |
587 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
588 | - $beginning_date->format( 'Y-m-d' ), |
|
589 | - $ending_date->format( 'Y-m-d' ) |
|
587 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
588 | + $beginning_date->format('Y-m-d'), |
|
589 | + $ending_date->format('Y-m-d') |
|
590 | 590 | ); |
591 | 591 | } |
592 | 592 | |
593 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
593 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
594 | 594 | |
595 | 595 | $report_params = array( |
596 | 596 | 'title' => $report_title, |
597 | 597 | 'subtitle' => $subtitle, |
598 | 598 | 'id' => $report_ID, |
599 | 599 | 'regs' => $regs, |
600 | - 'noResults' => empty( $regs ), |
|
600 | + 'noResults' => empty($regs), |
|
601 | 601 | 'noRegsMsg' => sprintf( |
602 | 602 | __( |
603 | 603 | '%sThere are currently no registration records in the last month for this report.%s', |
604 | 604 | 'event_espresso' |
605 | 605 | ), |
606 | - '<h2>' . $report_title . '</h2><p>', |
|
606 | + '<h2>'.$report_title.'</h2><p>', |
|
607 | 607 | '</p>' |
608 | 608 | ), |
609 | 609 | ); |
610 | - wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params ); |
|
610 | + wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
611 | 611 | |
612 | 612 | return $report_ID; |
613 | 613 | } |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | * @return void |
622 | 622 | */ |
623 | 623 | protected function _registration_checkin_list_table() { |
624 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
625 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
624 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
625 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
626 | 626 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
627 | 627 | $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2'); |
628 | 628 | |
@@ -636,15 +636,15 @@ discard block |
||
636 | 636 | 'desc' => __('This indicates the attendee has been checked out', 'event_espresso') |
637 | 637 | ) |
638 | 638 | ); |
639 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
639 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
640 | 640 | |
641 | 641 | |
642 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
643 | - $go_back_url = !empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; |
|
642 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
643 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; |
|
644 | 644 | |
645 | - $this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; |
|
646 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
647 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
645 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; |
|
646 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
647 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
648 | 648 | |
649 | 649 | $this->display_admin_list_table_page_with_no_sidebar(); |
650 | 650 | } |
@@ -657,24 +657,24 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function toggle_checkin_status() { |
659 | 659 | //first make sure we have the necessary data |
660 | - if ( !isset( $this->_req_data['_regid'] ) ) { |
|
661 | - EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
660 | + if ( ! isset($this->_req_data['_regid'])) { |
|
661 | + EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
662 | 662 | $this->_template_args['success'] = FALSE; |
663 | 663 | $this->_template_args['error'] = TRUE; |
664 | 664 | $this->_return_json(); |
665 | 665 | }; |
666 | 666 | |
667 | 667 | //do a nonce check cause we're not coming in from an normal route here. |
668 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : ''; |
|
668 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : ''; |
|
669 | 669 | $nonce_ref = 'checkin_nonce'; |
670 | 670 | |
671 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
671 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
672 | 672 | |
673 | 673 | //beautiful! Made it this far so let's get the status. |
674 | 674 | $new_status = $this->_toggle_checkin_status(); |
675 | 675 | |
676 | 676 | //setup new class to return via ajax |
677 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status; |
|
677 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status; |
|
678 | 678 | $this->_template_args['success'] = TRUE; |
679 | 679 | $this->_return_json(); |
680 | 680 | } |
@@ -694,32 +694,32 @@ discard block |
||
694 | 694 | //first let's get the query args out of the way for the redirect |
695 | 695 | $query_args = array( |
696 | 696 | 'action' => 'event_registrations', |
697 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL, |
|
698 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL |
|
697 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL, |
|
698 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL |
|
699 | 699 | ); |
700 | 700 | $new_status = FALSE; |
701 | 701 | |
702 | 702 | // bulk action check in toggle |
703 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
703 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
704 | 704 | // cycle thru checkboxes |
705 | - while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
706 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
705 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
706 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
707 | 707 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
708 | 708 | } |
709 | 709 | |
710 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
710 | + } elseif (isset($this->_req_data['_regid'])) { |
|
711 | 711 | //coming from ajax request |
712 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL; |
|
712 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL; |
|
713 | 713 | $query_args['DTT_ID'] = $DTT_ID; |
714 | 714 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
715 | 715 | } else { |
716 | - EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
716 | + EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
717 | 717 | } |
718 | 718 | |
719 | - if ( defined('DOING_AJAX' ) ) |
|
719 | + if (defined('DOING_AJAX')) |
|
720 | 720 | return $new_status; |
721 | 721 | |
722 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
|
722 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
723 | 723 | |
724 | 724 | } |
725 | 725 | |
@@ -735,11 +735,11 @@ discard block |
||
735 | 735 | */ |
736 | 736 | private function _toggle_checkin($REG_ID, $DTT_ID) { |
737 | 737 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
738 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
739 | - if ( $new_status !== FALSE ) { |
|
740 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) ); |
|
738 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
739 | + if ($new_status !== FALSE) { |
|
740 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
741 | 741 | } else { |
742 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ ); |
|
742 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__); |
|
743 | 743 | $new_status = FALSE; |
744 | 744 | } |
745 | 745 | return $new_status; |
@@ -755,28 +755,28 @@ discard block |
||
755 | 755 | protected function _delete_checkin_rows() { |
756 | 756 | $query_args = array( |
757 | 757 | 'action' => 'registration_checkins', |
758 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
759 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
758 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
759 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
760 | 760 | ); |
761 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
762 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
761 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
762 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
763 | 763 | $errors = 0; |
764 | - if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { |
|
764 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
765 | 765 | $errors++; |
766 | 766 | } |
767 | 767 | } |
768 | 768 | } else { |
769 | - EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
770 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
769 | + EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
770 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
771 | 771 | } |
772 | 772 | |
773 | - if ( $errors > 0 ) { |
|
774 | - EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); |
|
773 | + if ($errors > 0) { |
|
774 | + EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); |
|
775 | 775 | } else { |
776 | - EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); |
|
776 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
777 | 777 | } |
778 | 778 | |
779 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
779 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | |
@@ -788,20 +788,20 @@ discard block |
||
788 | 788 | protected function _delete_checkin_row() { |
789 | 789 | $query_args = array( |
790 | 790 | 'action' => 'registration_checkins', |
791 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
792 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
791 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
792 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
793 | 793 | ); |
794 | 794 | |
795 | - if ( !empty( $this->_req_data['CHK_ID'] ) ) { |
|
796 | - if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { |
|
797 | - EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
795 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
796 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
797 | + EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
798 | 798 | } else { |
799 | - EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); |
|
799 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
800 | 800 | } |
801 | 801 | } else { |
802 | - EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
802 | + EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
803 | 803 | } |
804 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
804 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | |
@@ -814,8 +814,8 @@ discard block |
||
814 | 814 | * @return void |
815 | 815 | */ |
816 | 816 | protected function _event_registrations_list_table() { |
817 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
818 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
817 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
818 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
819 | 819 | |
820 | 820 | $legend_items = array( |
821 | 821 | 'star-icon' => array( |
@@ -839,31 +839,31 @@ discard block |
||
839 | 839 | 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') |
840 | 840 | ), |
841 | 841 | 'approved_status' => array( |
842 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
843 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
842 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
843 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
844 | 844 | ), |
845 | 845 | 'cancelled_status' => array( |
846 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
847 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
846 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
847 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
848 | 848 | ), |
849 | 849 | 'declined_status' => array( |
850 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
851 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
850 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
851 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
852 | 852 | ), |
853 | 853 | 'not_approved' => array( |
854 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
855 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
854 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
855 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
856 | 856 | ), |
857 | 857 | 'pending_status' => array( |
858 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
859 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
858 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
859 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
860 | 860 | )/**/ |
861 | 861 | ); |
862 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
862 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
863 | 863 | |
864 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
865 | - $this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; |
|
866 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : ''; |
|
864 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
865 | + $this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; |
|
866 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : ''; |
|
867 | 867 | |
868 | 868 | $this->display_admin_list_table_page_with_no_sidebar(); |
869 | 869 | } |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | * @access public |
878 | 878 | * @return array |
879 | 879 | */ |
880 | - public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
|
880 | + public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { |
|
881 | 881 | |
882 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
883 | - require_once(EE_MODELS . 'EEM_Attendee.model.php'); |
|
882 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
883 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
884 | 884 | //$ATT_MDL = EEM_Attendee::instance(); |
885 | 885 | |
886 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
887 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE; |
|
888 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
886 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
887 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE; |
|
888 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
889 | 889 | |
890 | 890 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
891 | 891 | |
@@ -898,94 +898,94 @@ discard block |
||
898 | 898 | // $orderby = 'reg.REG_final_price'; |
899 | 899 | } |
900 | 900 | |
901 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
901 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
902 | 902 | |
903 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
904 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
903 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
904 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
905 | 905 | |
906 | 906 | |
907 | - $offset = ($current_page-1)*$per_page; |
|
908 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
909 | - $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
910 | - if ($EVT_ID){ |
|
911 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
907 | + $offset = ($current_page - 1) * $per_page; |
|
908 | + $limit = $count ? NULL : array($offset, $per_page); |
|
909 | + $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
910 | + if ($EVT_ID) { |
|
911 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
912 | 912 | } |
913 | - if($CAT_ID){ |
|
913 | + if ($CAT_ID) { |
|
914 | 914 | throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); |
915 | 915 | } |
916 | 916 | |
917 | 917 | //if DTT is included we do multiple datetimes. |
918 | - if ( $DTT_ID ) { |
|
918 | + if ($DTT_ID) { |
|
919 | 919 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
920 | 920 | } |
921 | 921 | |
922 | 922 | //make sure we only have default where on the current regs |
923 | 923 | $query_params['default_where_conditions'] = 'this_model_only'; |
924 | 924 | |
925 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
925 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
926 | 926 | |
927 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
927 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
928 | 928 | |
929 | - if($trash){ |
|
930 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed; |
|
929 | + if ($trash) { |
|
930 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
|
931 | 931 | } |
932 | 932 | |
933 | - if ( isset( $this->_req_data['s'] ) ) { |
|
934 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
933 | + if (isset($this->_req_data['s'])) { |
|
934 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
935 | 935 | $query_params[0]['OR'] = array( |
936 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
937 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
938 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
939 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
940 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
941 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
942 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
943 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
944 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
945 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
946 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
947 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
948 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
949 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
950 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
951 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
936 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
937 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
938 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
939 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
940 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
941 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
942 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
943 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
944 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
945 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
946 | + 'REG_final_price' => array('LIKE', $sstr), |
|
947 | + 'REG_code' => array('LIKE', $sstr), |
|
948 | + 'REG_count' => array('LIKE', $sstr), |
|
949 | + 'REG_group_size' => array('LIKE', $sstr), |
|
950 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
951 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
952 | 952 | ); |
953 | 953 | } |
954 | 954 | |
955 | 955 | $query_params['order_by'][$orderby] = $sort; |
956 | 956 | $query_params['limit'] = $limit; |
957 | - $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
958 | - if($count){ |
|
959 | - $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' )); |
|
960 | - }else{ |
|
957 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
958 | + if ($count) { |
|
959 | + $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only')); |
|
960 | + } else { |
|
961 | 961 | $registrations = EEM_Registration::instance()->get_all($query_params); |
962 | 962 | |
963 | 963 | |
964 | 964 | // $registrations = EEM_Registration::instance(); |
965 | 965 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
966 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
966 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
967 | 967 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
968 | 968 | // name |
969 | 969 | $first_registration = $registrations[0]; |
970 | 970 | $event_obj = $first_registration->event_obj(); |
971 | - if($event_obj){ |
|
971 | + if ($event_obj) { |
|
972 | 972 | $event_name = $first_registration->event_obj()->name(); |
973 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
973 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
974 | 974 | // edit event link |
975 | - if ( $event_name != '' ) { |
|
976 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
977 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
978 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
975 | + if ($event_name != '') { |
|
976 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
977 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
978 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
979 | 979 | } |
980 | 980 | |
981 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
982 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
981 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
982 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
983 | 983 | |
984 | 984 | $this->_template_args['before_admin_page_content'] = ' |
985 | 985 | <div id="admin-page-header"> |
986 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
987 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
988 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
986 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
987 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
988 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
989 | 989 | </div> |
990 | 990 | '; |
991 | 991 | } |
@@ -175,7 +175,7 @@ |
||
175 | 175 | * @param array $wpdb_row |
176 | 176 | * @param \WP_REST_Request $request |
177 | 177 | * @param Base $controller |
178 | - * @return int|null if permission denied |
|
178 | + * @return integer if permission denied |
|
179 | 179 | */ |
180 | 180 | public static function registrations_checked_in_count( $wpdb_row, $request, $controller ){ |
181 | 181 | if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @since $VID:$ |
16 | 16 | * |
17 | 17 | */ |
18 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
19 | - exit( 'No direct script access allowed' ); |
|
18 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | + exit('No direct script access allowed'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Event extends Calculations_Base { |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @return int |
33 | 33 | * @throws \EE_Error |
34 | 34 | */ |
35 | - public static function optimum_sales_at_start( $wpdb_row, $request, $controller ){ |
|
36 | - if( is_array( $wpdb_row ) && isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
37 | - $event_obj = \EEM_Event::instance()->get_one_by_ID( $wpdb_row[ 'Event_CPT.ID' ] ); |
|
35 | + public static function optimum_sales_at_start($wpdb_row, $request, $controller) { |
|
36 | + if (is_array($wpdb_row) && isset($wpdb_row['Event_CPT.ID'])) { |
|
37 | + $event_obj = \EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
38 | 38 | } else { |
39 | 39 | $event_obj = null; |
40 | 40 | } |
41 | - if( $event_obj instanceof \EE_Event ) { |
|
42 | - return $event_obj->total_available_spaces( true ); |
|
41 | + if ($event_obj instanceof \EE_Event) { |
|
42 | + return $event_obj->total_available_spaces(true); |
|
43 | 43 | } else { |
44 | 44 | throw new \EE_Error( |
45 | 45 | sprintf( |
46 | - __( 'Cannot calculate optimum_sales_at_start because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso' ), |
|
47 | - $wpdb_row[ 'Event_CPT.ID' ], |
|
48 | - print_r( $wpdb_row, true ) |
|
46 | + __('Cannot calculate optimum_sales_at_start because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso'), |
|
47 | + $wpdb_row['Event_CPT.ID'], |
|
48 | + print_r($wpdb_row, true) |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | } |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @return int |
65 | 65 | * @throws \EE_Error |
66 | 66 | */ |
67 | - public static function optimum_sales_now( $wpdb_row, $request, $controller ){ |
|
68 | - if( is_array( $wpdb_row ) && isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
69 | - $event_obj = \EEM_Event::instance()->get_one_by_ID( $wpdb_row[ 'Event_CPT.ID' ] ); |
|
67 | + public static function optimum_sales_now($wpdb_row, $request, $controller) { |
|
68 | + if (is_array($wpdb_row) && isset($wpdb_row['Event_CPT.ID'])) { |
|
69 | + $event_obj = \EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
70 | 70 | } else { |
71 | 71 | $event_obj = null; |
72 | 72 | } |
73 | - if( $event_obj instanceof \EE_Event ) { |
|
74 | - return $event_obj->total_available_spaces( false ); |
|
73 | + if ($event_obj instanceof \EE_Event) { |
|
74 | + return $event_obj->total_available_spaces(false); |
|
75 | 75 | } else { |
76 | 76 | throw new \EE_Error( |
77 | 77 | sprintf( |
78 | - __( 'Cannot calculate optimum_sales_now because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso' ), |
|
79 | - $wpdb_row[ 'Event_CPT.ID' ], |
|
80 | - print_r( $wpdb_row, true ) |
|
78 | + __('Cannot calculate optimum_sales_now because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso'), |
|
79 | + $wpdb_row['Event_CPT.ID'], |
|
80 | + print_r($wpdb_row, true) |
|
81 | 81 | ) |
82 | 82 | ); |
83 | 83 | } |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | * @return int |
96 | 96 | * @throws \EE_Error |
97 | 97 | */ |
98 | - public static function spaces_remaining( $wpdb_row, $request, $controller ){ |
|
99 | - if( is_array( $wpdb_row ) && isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
100 | - $event_obj = \EEM_Event::instance()->get_one_by_ID( $wpdb_row[ 'Event_CPT.ID' ] ); |
|
98 | + public static function spaces_remaining($wpdb_row, $request, $controller) { |
|
99 | + if (is_array($wpdb_row) && isset($wpdb_row['Event_CPT.ID'])) { |
|
100 | + $event_obj = \EEM_Event::instance()->get_one_by_ID($wpdb_row['Event_CPT.ID']); |
|
101 | 101 | } else { |
102 | 102 | $event_obj = null; |
103 | 103 | } |
104 | - if( $event_obj instanceof \EE_Event ) { |
|
104 | + if ($event_obj instanceof \EE_Event) { |
|
105 | 105 | return $event_obj->spaces_remaining_for_sale(); |
106 | 106 | } else { |
107 | 107 | throw new \EE_Error( |
108 | 108 | sprintf( |
109 | - __( 'Cannot calculate spaces_remaining because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso' ), |
|
110 | - $wpdb_row[ 'Event_CPT.ID' ], |
|
111 | - print_r( $wpdb_row, true ) |
|
109 | + __('Cannot calculate spaces_remaining because the event with ID %1$s (from database row %2$s) was not found', 'event_espresso'), |
|
110 | + $wpdb_row['Event_CPT.ID'], |
|
111 | + print_r($wpdb_row, true) |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | * @return int |
127 | 127 | * @throws \EE_Error |
128 | 128 | */ |
129 | - public static function spots_taken( $wpdb_row, $request, $controller ){ |
|
130 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
129 | + public static function spots_taken($wpdb_row, $request, $controller) { |
|
130 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) { |
|
131 | 131 | throw new \EE_Error( |
132 | 132 | sprintf( |
133 | - __( 'Cannot calculate spots_taken because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso' ), |
|
134 | - print_r( $wpdb_row, true ) |
|
133 | + __('Cannot calculate spots_taken because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso'), |
|
134 | + print_r($wpdb_row, true) |
|
135 | 135 | ) |
136 | 136 | ); |
137 | 137 | } |
138 | 138 | return \EEM_Registration::instance()->count( |
139 | 139 | array( |
140 | 140 | array( |
141 | - 'EVT_ID' => $wpdb_row[ 'Event_CPT.ID' ], |
|
141 | + 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
142 | 142 | 'STS_ID' => \EEM_Registration::status_id_approved |
143 | 143 | ) |
144 | 144 | ), |
@@ -160,20 +160,20 @@ discard block |
||
160 | 160 | * @throws \EE_Error |
161 | 161 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
162 | 162 | */ |
163 | - public static function spots_taken_pending_payment( $wpdb_row, $request, $controller ){ |
|
164 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
163 | + public static function spots_taken_pending_payment($wpdb_row, $request, $controller) { |
|
164 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) { |
|
165 | 165 | throw new \EE_Error( |
166 | 166 | sprintf( |
167 | - __( 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso' ), |
|
168 | - print_r( $wpdb_row, true ) |
|
167 | + __('Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso'), |
|
168 | + print_r($wpdb_row, true) |
|
169 | 169 | ) |
170 | 170 | ); |
171 | 171 | } |
172 | - self::_verify_current_user_can( 'ee_read_registrations', 'spots_taken_pending_payment' ); |
|
172 | + self::_verify_current_user_can('ee_read_registrations', 'spots_taken_pending_payment'); |
|
173 | 173 | return \EEM_Registration::instance()->count( |
174 | 174 | array( |
175 | 175 | array( |
176 | - 'EVT_ID' => $wpdb_row[ 'Event_CPT.ID' ], |
|
176 | + 'EVT_ID' => $wpdb_row['Event_CPT.ID'], |
|
177 | 177 | 'STS_ID' => \EEM_Registration::status_id_pending_payment |
178 | 178 | ) |
179 | 179 | ), |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | * @throws \EE_Error |
196 | 196 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
197 | 197 | */ |
198 | - public static function registrations_checked_in_count( $wpdb_row, $request, $controller ){ |
|
199 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
198 | + public static function registrations_checked_in_count($wpdb_row, $request, $controller) { |
|
199 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) { |
|
200 | 200 | throw new \EE_Error( |
201 | 201 | sprintf( |
202 | - __( 'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso' ), |
|
203 | - print_r( $wpdb_row, true ) |
|
202 | + __('Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso'), |
|
203 | + print_r($wpdb_row, true) |
|
204 | 204 | ) |
205 | 205 | ); |
206 | 206 | } |
207 | - self::_verify_current_user_can( 'ee_read_checkins', 'registrations_checked_in_count' ); |
|
208 | - return \EEM_Registration::instance()->count_registrations_checked_into_event( $wpdb_row[ 'Event_CPT.ID' ], true ); |
|
207 | + self::_verify_current_user_can('ee_read_checkins', 'registrations_checked_in_count'); |
|
208 | + return \EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], true); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | * @throws \EE_Error |
222 | 222 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
223 | 223 | */ |
224 | - public static function registrations_checked_out_count( $wpdb_row, $request, $controller ){ |
|
225 | - if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
224 | + public static function registrations_checked_out_count($wpdb_row, $request, $controller) { |
|
225 | + if ( ! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) { |
|
226 | 226 | throw new \EE_Error( |
227 | 227 | sprintf( |
228 | - __( 'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso' ), |
|
229 | - print_r( $wpdb_row, true ) |
|
228 | + __('Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso'), |
|
229 | + print_r($wpdb_row, true) |
|
230 | 230 | ) |
231 | 231 | ); |
232 | 232 | } |
233 | - self::_verify_current_user_can( 'ee_read_checkins', 'registrations_checked_out_count' ); |
|
234 | - return \EEM_Registration::instance()->count_registrations_checked_into_event( $wpdb_row[ 'Event_CPT.ID' ], false ); |
|
233 | + self::_verify_current_user_can('ee_read_checkins', 'registrations_checked_out_count'); |
|
234 | + return \EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], false); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * @param Base $controller |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public static function image_thumbnail( $wpdb_row, $request, $controller ) { |
|
245 | - return self::_calculate_image_data($wpdb_row[ 'Event_CPT.ID' ], 'thumbnail' ); |
|
244 | + public static function image_thumbnail($wpdb_row, $request, $controller) { |
|
245 | + return self::_calculate_image_data($wpdb_row['Event_CPT.ID'], 'thumbnail'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * @param Base $controller |
253 | 253 | * @return array |
254 | 254 | */ |
255 | - public static function image_medium( $wpdb_row, $request, $controller ) { |
|
256 | - return self::_calculate_image_data($wpdb_row[ 'Event_CPT.ID' ], 'medium' ); |
|
255 | + public static function image_medium($wpdb_row, $request, $controller) { |
|
256 | + return self::_calculate_image_data($wpdb_row['Event_CPT.ID'], 'medium'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @param Base $controller |
264 | 264 | * @return array |
265 | 265 | */ |
266 | - public static function image_medium_large( $wpdb_row, $request, $controller ) { |
|
267 | - return self::_calculate_image_data($wpdb_row[ 'Event_CPT.ID' ], 'medium_large' ); |
|
266 | + public static function image_medium_large($wpdb_row, $request, $controller) { |
|
267 | + return self::_calculate_image_data($wpdb_row['Event_CPT.ID'], 'medium_large'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @param Base $controller |
275 | 275 | * @return array |
276 | 276 | */ |
277 | - public static function image_large( $wpdb_row, $request, $controller ) { |
|
278 | - return self::_calculate_image_data($wpdb_row[ 'Event_CPT.ID' ], 'large' ); |
|
277 | + public static function image_large($wpdb_row, $request, $controller) { |
|
278 | + return self::_calculate_image_data($wpdb_row['Event_CPT.ID'], 'large'); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | * @param Base $controller |
286 | 286 | * @return array |
287 | 287 | */ |
288 | - public static function image_post_thumbnail( $wpdb_row, $request, $controller ) { |
|
289 | - return self::_calculate_image_data($wpdb_row[ 'Event_CPT.ID' ], 'post-thumbnail' ); |
|
288 | + public static function image_post_thumbnail($wpdb_row, $request, $controller) { |
|
289 | + return self::_calculate_image_data($wpdb_row['Event_CPT.ID'], 'post-thumbnail'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | * @param Base $controller |
297 | 297 | * @return array |
298 | 298 | */ |
299 | - public static function image_full( $wpdb_row, $request, $controller ) { |
|
300 | - return self::_calculate_image_data($wpdb_row[ 'Event_CPT.ID' ], 'full' ); |
|
299 | + public static function image_full($wpdb_row, $request, $controller) { |
|
300 | + return self::_calculate_image_data($wpdb_row['Event_CPT.ID'], 'full'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -307,21 +307,21 @@ discard block |
||
307 | 307 | * @param string $image_size one of these: thumbnail, medium, medium_large, large, post-thumbnail, full |
308 | 308 | * @return array|false if no such image exists. If array it will have keys 'url', 'width', 'height' and 'original' |
309 | 309 | */ |
310 | - protected static function _calculate_image_data( $EVT_ID, $image_size ) { |
|
311 | - $attachment_id = get_post_thumbnail_id( $EVT_ID ); |
|
312 | - $data = wp_get_attachment_image_src( $attachment_id, $image_size ); |
|
313 | - if( ! $data ) { |
|
310 | + protected static function _calculate_image_data($EVT_ID, $image_size) { |
|
311 | + $attachment_id = get_post_thumbnail_id($EVT_ID); |
|
312 | + $data = wp_get_attachment_image_src($attachment_id, $image_size); |
|
313 | + if ( ! $data) { |
|
314 | 314 | return false; |
315 | 315 | } |
316 | - if( isset( $data[ 3] ) ) { |
|
317 | - $generated = $data[ 3 ]; |
|
316 | + if (isset($data[3])) { |
|
317 | + $generated = $data[3]; |
|
318 | 318 | } else { |
319 | 319 | $generated = true; |
320 | 320 | } |
321 | 321 | return array( |
322 | - 'url' => $data[ 0 ], |
|
323 | - 'width' => $data[ 1 ], |
|
324 | - 'height' => $data[ 2 ], |
|
322 | + 'url' => $data[0], |
|
323 | + 'width' => $data[1], |
|
324 | + 'height' => $data[2], |
|
325 | 325 | 'generated' => $generated |
326 | 326 | ); |
327 | 327 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Prepares incoming data from the json or $_REQUEST parameters for the models' |
57 | 57 | * "$query_params". |
58 | - * @param EE_Model_Field_Base $field_obj |
|
58 | + * @param \EE_Model_Field_Base $field_obj |
|
59 | 59 | * @param mixed $original_value |
60 | 60 | * @param string $requested_version |
61 | 61 | * @return mixed |
@@ -77,6 +77,7 @@ discard block |
||
77 | 77 | * Prepares a field's value for display in the API |
78 | 78 | * @param \EE_Model_Field_Base $field_obj |
79 | 79 | * @param mixed $original_value |
80 | + * @param string $requested_version |
|
80 | 81 | * @return mixed |
81 | 82 | */ |
82 | 83 | public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
@@ -131,6 +132,9 @@ discard block |
||
131 | 132 | return $query_param_for_models; |
132 | 133 | } |
133 | 134 | |
135 | + /** |
|
136 | + * @return string |
|
137 | + */ |
|
134 | 138 | public static function remove_stars_and_anything_after_from_condition_query_param_key( $condition_query_param_key ) { |
135 | 139 | $pos_of_star = strpos($condition_query_param_key, '*'); |
136 | 140 | if($pos_of_star === FALSE){ |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | |
24 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
25 | - exit( 'No direct script access allowed' ); |
|
24 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | class Model_Data_Translator { |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * @param string $requested_version |
41 | 41 | * @return mixed |
42 | 42 | */ |
43 | - public static function prepare_field_values_from_json( $field_obj, $original_value_maybe_array, $requested_version ) { |
|
44 | - if( is_array( $original_value_maybe_array ) ) { |
|
43 | + public static function prepare_field_values_from_json($field_obj, $original_value_maybe_array, $requested_version) { |
|
44 | + if (is_array($original_value_maybe_array)) { |
|
45 | 45 | $new_value_maybe_array = array(); |
46 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
47 | - $new_value_maybe_array[ $array_key ] = self::prepare_field_value_from_json( $field_obj, $array_item, $requested_version ); |
|
46 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
47 | + $new_value_maybe_array[$array_key] = self::prepare_field_value_from_json($field_obj, $array_item, $requested_version); |
|
48 | 48 | } |
49 | 49 | } else { |
50 | - $new_value_maybe_array = self::prepare_field_value_from_json( $field_obj, $original_value_maybe_array, $requested_version ); |
|
50 | + $new_value_maybe_array = self::prepare_field_value_from_json($field_obj, $original_value_maybe_array, $requested_version); |
|
51 | 51 | } |
52 | 52 | return $new_value_maybe_array; |
53 | 53 | } |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | * @param string $requested_version |
61 | 61 | * @return mixed |
62 | 62 | */ |
63 | - public static function prepare_field_value_from_json( $field_obj, $original_value, $requested_version ) { |
|
63 | + public static function prepare_field_value_from_json($field_obj, $original_value, $requested_version) { |
|
64 | 64 | $new_value = null; |
65 | - if( $field_obj instanceof \EE_Infinite_Integer_Field |
|
66 | - && in_array( $original_value, array( null, '' ), true ) ) { |
|
65 | + if ($field_obj instanceof \EE_Infinite_Integer_Field |
|
66 | + && in_array($original_value, array(null, ''), true)) { |
|
67 | 67 | $new_value = EE_INF; |
68 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
69 | - $new_value = rest_parse_date( $original_value ); |
|
68 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
69 | + $new_value = rest_parse_date($original_value); |
|
70 | 70 | } else { |
71 | 71 | $new_value = $original_value; |
72 | 72 | } |
@@ -79,17 +79,17 @@ discard block |
||
79 | 79 | * @param mixed $original_value |
80 | 80 | * @return mixed |
81 | 81 | */ |
82 | - public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
|
83 | - if( $original_value === EE_INF ) { |
|
82 | + public static function prepare_field_value_for_json($field_obj, $original_value, $requested_version) { |
|
83 | + if ($original_value === EE_INF) { |
|
84 | 84 | $new_value = self::ee_inf_in_rest; |
85 | - } elseif( $field_obj instanceof \EE_Datetime_Field && |
|
86 | - $original_value instanceof \DateTime ) { |
|
87 | - $new_value = $original_value->format( 'c' ); |
|
88 | - $new_value = mysql_to_rfc3339( $new_value ); |
|
85 | + } elseif ($field_obj instanceof \EE_Datetime_Field && |
|
86 | + $original_value instanceof \DateTime) { |
|
87 | + $new_value = $original_value->format('c'); |
|
88 | + $new_value = mysql_to_rfc3339($new_value); |
|
89 | 89 | } else { |
90 | 90 | $new_value = $original_value; |
91 | 91 | } |
92 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
92 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
93 | 93 | $new_value, |
94 | 94 | $field_obj, |
95 | 95 | $original_value, |
@@ -105,37 +105,37 @@ discard block |
||
105 | 105 | * @param string $requested_version |
106 | 106 | * @return array |
107 | 107 | */ |
108 | - public static function prepare_conditions_query_params_for_models( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
108 | + public static function prepare_conditions_query_params_for_models($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
109 | 109 | $query_param_for_models = array(); |
110 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
110 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
111 | 111 | $field = self::deduce_field_from_query_param( |
112 | - self::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
112 | + self::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
113 | 113 | $model |
114 | 114 | ); |
115 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
115 | + if ($field instanceof \EE_Model_Field_Base) { |
|
116 | 116 | //did they specify an operator? |
117 | - if( is_array( $query_param_value ) ) { |
|
118 | - $op = $query_param_value[ 0 ]; |
|
119 | - $value = $query_param_value[ 1 ]; |
|
120 | - $new_value = self::prepare_field_values_from_json( $field, $value, $requested_version ); |
|
121 | - $translated_value = array( $op, $new_value ); |
|
117 | + if (is_array($query_param_value)) { |
|
118 | + $op = $query_param_value[0]; |
|
119 | + $value = $query_param_value[1]; |
|
120 | + $new_value = self::prepare_field_values_from_json($field, $value, $requested_version); |
|
121 | + $translated_value = array($op, $new_value); |
|
122 | 122 | } else { |
123 | - $translated_value = self::prepare_field_value_from_json( $field, $query_param_value, $requested_version ); |
|
123 | + $translated_value = self::prepare_field_value_from_json($field, $query_param_value, $requested_version); |
|
124 | 124 | } |
125 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
125 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
126 | 126 | } else { |
127 | 127 | //so it's not for a field, assume it's a logic query param key |
128 | - $query_param_for_models[ $query_param_key ] = self::prepare_conditions_query_params_for_models( $query_param_value, $model, $requested_version ); |
|
128 | + $query_param_for_models[$query_param_key] = self::prepare_conditions_query_params_for_models($query_param_value, $model, $requested_version); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | return $query_param_for_models; |
132 | 132 | } |
133 | 133 | |
134 | - public static function remove_stars_and_anything_after_from_condition_query_param_key( $condition_query_param_key ) { |
|
134 | + public static function remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key) { |
|
135 | 135 | $pos_of_star = strpos($condition_query_param_key, '*'); |
136 | - if($pos_of_star === FALSE){ |
|
136 | + if ($pos_of_star === FALSE) { |
|
137 | 137 | return $condition_query_param_key; |
138 | - }else{ |
|
138 | + } else { |
|
139 | 139 | $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star); |
140 | 140 | return $condition_query_param_sans_star; |
141 | 141 | } |
@@ -147,26 +147,26 @@ discard block |
||
147 | 147 | * @throws EE_Error |
148 | 148 | * @return EE_Model_Field_Base |
149 | 149 | */ |
150 | - public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model){ |
|
150 | + public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model) { |
|
151 | 151 | //ok, now proceed with deducing which part is the model's name, and which is the field's name |
152 | 152 | //which will help us find the database table and column |
153 | 153 | |
154 | - $query_param_parts = explode(".",$query_param_name); |
|
155 | - if(empty($query_param_parts)){ |
|
156 | - throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s",'event_espresso'),$query_param_name)); |
|
154 | + $query_param_parts = explode(".", $query_param_name); |
|
155 | + if (empty($query_param_parts)) { |
|
156 | + throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s", 'event_espresso'), $query_param_name)); |
|
157 | 157 | } |
158 | 158 | $number_of_parts = count($query_param_parts); |
159 | - $last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ]; |
|
160 | - if($number_of_parts == 1){ |
|
159 | + $last_query_param_part = $query_param_parts[count($query_param_parts) - 1]; |
|
160 | + if ($number_of_parts == 1) { |
|
161 | 161 | $field_name = $last_query_param_part; |
162 | - }else{// $number_of_parts >= 2 |
|
162 | + } else {// $number_of_parts >= 2 |
|
163 | 163 | //the last part is the column name, and there are only 2parts. therefore... |
164 | 164 | $field_name = $last_query_param_part; |
165 | - $model = \EE_Registry::instance()->load_model( $query_param_parts[ $number_of_parts - 2 ]); |
|
165 | + $model = \EE_Registry::instance()->load_model($query_param_parts[$number_of_parts - 2]); |
|
166 | 166 | } |
167 | - try{ |
|
167 | + try { |
|
168 | 168 | return $model->field_settings_for($field_name); |
169 | - }catch(\EE_Error $e){ |
|
169 | + } catch (\EE_Error $e) { |
|
170 | 170 | return null; |
171 | 171 | } |
172 | 172 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $pos_of_star = strpos($condition_query_param_key, '*'); |
136 | 136 | if($pos_of_star === FALSE){ |
137 | 137 | return $condition_query_param_key; |
138 | - }else{ |
|
138 | + } else{ |
|
139 | 139 | $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star); |
140 | 140 | return $condition_query_param_sans_star; |
141 | 141 | } |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ]; |
160 | 160 | if($number_of_parts == 1){ |
161 | 161 | $field_name = $last_query_param_part; |
162 | - }else{// $number_of_parts >= 2 |
|
162 | + } else{// $number_of_parts >= 2 |
|
163 | 163 | //the last part is the column name, and there are only 2parts. therefore... |
164 | 164 | $field_name = $last_query_param_part; |
165 | 165 | $model = \EE_Registry::instance()->load_model( $query_param_parts[ $number_of_parts - 2 ]); |
166 | 166 | } |
167 | 167 | try{ |
168 | 168 | return $model->field_settings_for($field_name); |
169 | - }catch(\EE_Error $e){ |
|
169 | + } catch(\EE_Error $e){ |
|
170 | 170 | return null; |
171 | 171 | } |
172 | 172 | } |
@@ -1,24 +1,24 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
3 | 3 | /** |
4 | - * |
|
5 | - * Class Model_Data_Translator |
|
6 | - * |
|
7 | - * Class for translating data between the EE4 models and JSON. |
|
8 | - * Some of this class needs to interpret an incoming array of query params from |
|
9 | - * the REST API and prepare it for use by the models. Some of this code seems duplicated |
|
10 | - * fromt he models but it's anticipated to diverge (because providing parameters |
|
11 | - * in the REST API is sometimes more difficult than in PHP directly. Eg, providing an array like |
|
12 | - * array( 'where' => array( 'EVT_ID' => array( '<', 100 ) ) ) in PHP is easy, but in a querystring it needs to look like |
|
13 | - * "where[EVT_ID][]=<&where[EVT_ID][]=100" is less intuitive, so we may want |
|
14 | - * to allow REST API query parameters to diverge from the format accepted by models) |
|
15 | - * |
|
16 | - * @package Event Espresso |
|
17 | - * @subpackage |
|
18 | - * @author Mike Nelson |
|
19 | - * @since 4.8.36 |
|
20 | - * |
|
21 | - */ |
|
4 | + * |
|
5 | + * Class Model_Data_Translator |
|
6 | + * |
|
7 | + * Class for translating data between the EE4 models and JSON. |
|
8 | + * Some of this class needs to interpret an incoming array of query params from |
|
9 | + * the REST API and prepare it for use by the models. Some of this code seems duplicated |
|
10 | + * fromt he models but it's anticipated to diverge (because providing parameters |
|
11 | + * in the REST API is sometimes more difficult than in PHP directly. Eg, providing an array like |
|
12 | + * array( 'where' => array( 'EVT_ID' => array( '<', 100 ) ) ) in PHP is easy, but in a querystring it needs to look like |
|
13 | + * "where[EVT_ID][]=<&where[EVT_ID][]=100" is less intuitive, so we may want |
|
14 | + * to allow REST API query parameters to diverge from the format accepted by models) |
|
15 | + * |
|
16 | + * @package Event Espresso |
|
17 | + * @subpackage |
|
18 | + * @author Mike Nelson |
|
19 | + * @since 4.8.36 |
|
20 | + * |
|
21 | + */ |
|
22 | 22 | |
23 | 23 | |
24 | 24 | if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Prepares a field's value for display in the API |
|
78 | - * @param \EE_Model_Field_Base $field_obj |
|
79 | - * @param mixed $original_value |
|
80 | - * @return mixed |
|
81 | - */ |
|
77 | + * Prepares a field's value for display in the API |
|
78 | + * @param \EE_Model_Field_Base $field_obj |
|
79 | + * @param mixed $original_value |
|
80 | + * @return mixed |
|
81 | + */ |
|
82 | 82 | public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
83 | 83 | if( $original_value === EE_INF ) { |
84 | 84 | $new_value = self::ee_inf_in_rest; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $original_value, |
96 | 96 | $requested_version |
97 | 97 | ); |
98 | - } |
|
98 | + } |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Prepares condition-query-parameters (like what's in where and having) from |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers\model; |
3 | 3 | use EventEspresso\core\libraries\rest_api\Model_Data_Translator; |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | * @param \WP_REST_Request $request |
24 | 24 | * @return array|\WP_REST_Response |
25 | 25 | */ |
26 | - public static function handle_request_models_meta( \WP_REST_Request $request ) { |
|
26 | + public static function handle_request_models_meta(\WP_REST_Request $request) { |
|
27 | 27 | $controller = new Meta(); |
28 | - try{ |
|
28 | + try { |
|
29 | 29 | $matches = $controller->parse_route( |
30 | 30 | $request->get_route(), |
31 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', |
|
32 | - array( 'version' ) ); |
|
33 | - if( $matches instanceof \WP_REST_Response ) { |
|
31 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~', |
|
32 | + array('version') ); |
|
33 | + if ($matches instanceof \WP_REST_Response) { |
|
34 | 34 | return $matches; |
35 | 35 | } |
36 | - $controller->set_requested_version( $matches[ 'version' ] ); |
|
37 | - return $controller->send_response( $controller->_get_models_metadata_entity() ); |
|
38 | - } catch( \Exception $e ) { |
|
39 | - return $controller->send_response( $e ); |
|
36 | + $controller->set_requested_version($matches['version']); |
|
37 | + return $controller->send_response($controller->_get_models_metadata_entity()); |
|
38 | + } catch (\Exception $e) { |
|
39 | + return $controller->send_response($e); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -44,22 +44,22 @@ discard block |
||
44 | 44 | * Gets the model metadata resource entity |
45 | 45 | * @return array for JSON response, describing all the models available in teh requested version |
46 | 46 | */ |
47 | - protected function _get_models_metadata_entity(){ |
|
47 | + protected function _get_models_metadata_entity() { |
|
48 | 48 | $response = array(); |
49 | - foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){ |
|
50 | - $model = $this->get_model_version_info()->load_model( $model_name ); |
|
49 | + foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) { |
|
50 | + $model = $this->get_model_version_info()->load_model($model_name); |
|
51 | 51 | $fields_json = array(); |
52 | - foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) { |
|
53 | - if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) { |
|
52 | + foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) { |
|
53 | + if ($this->get_model_version_info()->field_is_ignored($field_obj)) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | - if( $field_obj instanceof \EE_Boolean_Field ) { |
|
56 | + if ($field_obj instanceof \EE_Boolean_Field) { |
|
57 | 57 | $datatype = 'Boolean'; |
58 | - }elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
58 | + }elseif ($field_obj->get_wpdb_data_type() == '%d') { |
|
59 | 59 | $datatype = 'Number'; |
60 | - }elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
60 | + }elseif ($field_name instanceof \EE_Serialized_Text_Field) { |
|
61 | 61 | $datatype = 'Object'; |
62 | - }else{ |
|
62 | + } else { |
|
63 | 63 | $datatype = 'String'; |
64 | 64 | } |
65 | 65 | $default_value = Model_Data_Translator::prepare_field_value_for_json( |
@@ -70,30 +70,30 @@ discard block |
||
70 | 70 | $field_json = array( |
71 | 71 | 'name' => $field_name, |
72 | 72 | 'nicename' => $field_obj->get_nicename(), |
73 | - 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ), |
|
74 | - 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ), |
|
75 | - 'type' => str_replace('EE_', '', get_class( $field_obj ) ), |
|
73 | + 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj), |
|
74 | + 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj), |
|
75 | + 'type' => str_replace('EE_', '', get_class($field_obj)), |
|
76 | 76 | 'datatype' => $datatype, |
77 | 77 | 'nullable' => $field_obj->is_nullable(), |
78 | 78 | 'default' => $default_value, |
79 | 79 | 'table_alias' => $field_obj->get_table_alias(), |
80 | 80 | 'table_column' => $field_obj->get_table_column(), |
81 | 81 | ); |
82 | - $fields_json[ $field_json[ 'name' ] ] = $field_json; |
|
82 | + $fields_json[$field_json['name']] = $field_json; |
|
83 | 83 | |
84 | 84 | } |
85 | - $fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) ); |
|
86 | - $response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model ); |
|
85 | + $fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model)); |
|
86 | + $response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model); |
|
87 | 87 | $relations_json = array(); |
88 | - foreach( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
88 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
89 | 89 | $relation_json = array( |
90 | 90 | 'name' => $relation_name, |
91 | - 'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ), |
|
91 | + 'type' => str_replace('EE_', '', get_class($relation_obj)), |
|
92 | 92 | 'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false, |
93 | 93 | ); |
94 | - $relations_json[ $relation_name ] = $relation_json; |
|
94 | + $relations_json[$relation_name] = $relation_json; |
|
95 | 95 | } |
96 | - $response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model ); |
|
96 | + $response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model); |
|
97 | 97 | } |
98 | 98 | return $response; |
99 | 99 | } |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | * @param \WP_REST_Response $rest_response_obj |
104 | 104 | * @return \WP_REST_Response |
105 | 105 | */ |
106 | - public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) { |
|
106 | + public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) { |
|
107 | 107 | $response_data = $rest_response_obj->get_data(); |
108 | 108 | $addons = array(); |
109 | - foreach( \EE_Registry::instance()->addons as $addon){ |
|
109 | + foreach (\EE_Registry::instance()->addons as $addon) { |
|
110 | 110 | $addon_json = array( |
111 | 111 | 'name' => $addon->name(), |
112 | 112 | 'version' => $addon->version() |
113 | 113 | ); |
114 | - $addons[ $addon_json[ 'name' ] ] = $addon_json; |
|
114 | + $addons[$addon_json['name']] = $addon_json; |
|
115 | 115 | } |
116 | - $response_data[ 'ee' ] = array( |
|
116 | + $response_data['ee'] = array( |
|
117 | 117 | 'version' => \EEM_System_Status::instance()->get_ee_version(), |
118 | 118 | 'addons' => $addons, |
119 | 119 | 'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(), |
120 | - 'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ) |
|
120 | + 'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()) |
|
121 | 121 | ); |
122 | - $rest_response_obj->set_data( $response_data ); |
|
122 | + $rest_response_obj->set_data($response_data); |
|
123 | 123 | return $rest_response_obj; |
124 | 124 | } |
125 | 125 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers; |
3 | 3 | use EventEspresso\core\libraries\rest_api\Rest_Exception; |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | public function __construct() { |
52 | - $this->_debug_mode = defined( 'EE_REST_API_DEBUG_MODE' ) ? EE_REST_API_DEBUG_MODE : false; |
|
52 | + $this->_debug_mode = defined('EE_REST_API_DEBUG_MODE') ? EE_REST_API_DEBUG_MODE : false; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Sets the version the user requested |
58 | 58 | * @param string $version eg '4.8' |
59 | 59 | */ |
60 | - public function set_requested_version( $version ) { |
|
60 | + public function set_requested_version($version) { |
|
61 | 61 | $this->_requested_version = $version; |
62 | 62 | } |
63 | 63 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @param string $key |
67 | 67 | * @param string|array $info |
68 | 68 | */ |
69 | - protected function _set_debug_info( $key, $info ){ |
|
70 | - $this->_debug_info[ $key ] = $info; |
|
69 | + protected function _set_debug_info($key, $info) { |
|
70 | + $this->_debug_info[$key] = $info; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * @param boolean $use_ee_prefix whether to use the EE prefix on the header, or fallback to |
80 | 80 | * the standard WP one |
81 | 81 | */ |
82 | - protected function _set_response_header( $header_key, $value, $use_ee_prefix = true ) { |
|
83 | - if( is_array( $value ) ) { |
|
84 | - foreach( $value as $value_key => $value_value ) { |
|
85 | - $this->_set_response_header( $header_key . '[' . $value_key . ']', $value_value ); |
|
82 | + protected function _set_response_header($header_key, $value, $use_ee_prefix = true) { |
|
83 | + if (is_array($value)) { |
|
84 | + foreach ($value as $value_key => $value_value) { |
|
85 | + $this->_set_response_header($header_key.'['.$value_key.']', $value_value); |
|
86 | 86 | } |
87 | 87 | } else { |
88 | 88 | $prefix = $use_ee_prefix ? Base::header_prefix_for_ee : Base::header_prefix_for_wp; |
89 | - $this->_response_headers[ $prefix . $header_key ] = $value; |
|
89 | + $this->_response_headers[$prefix.$header_key] = $value; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return array |
96 | 96 | */ |
97 | 97 | protected function _get_response_headers() { |
98 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers', |
|
98 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers', |
|
99 | 99 | $this->_response_headers, |
100 | 100 | $this, |
101 | 101 | $this->_requested_version |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | * @param \WP_Error $wp_error_response |
108 | 108 | * @return \WP_Error |
109 | 109 | */ |
110 | - protected function _add_ee_errors_to_response( \WP_Error $wp_error_response ) { |
|
110 | + protected function _add_ee_errors_to_response(\WP_Error $wp_error_response) { |
|
111 | 111 | $notices_during_checkin = \EE_Error::get_raw_notices(); |
112 | - if( ! empty( $notices_during_checkin[ 'errors' ] ) ) { |
|
113 | - foreach( $notices_during_checkin[ 'errors' ] as $error_code => $error_message ) { |
|
112 | + if ( ! empty($notices_during_checkin['errors'])) { |
|
113 | + foreach ($notices_during_checkin['errors'] as $error_code => $error_message) { |
|
114 | 114 | $wp_error_response->add( |
115 | - sanitize_key( $error_code ), |
|
116 | - strip_tags( $error_message ) ); |
|
115 | + sanitize_key($error_code), |
|
116 | + strip_tags($error_message) ); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | return $wp_error_response; |
@@ -131,27 +131,27 @@ discard block |
||
131 | 131 | * @param array|\WP_Error|\Exception $response |
132 | 132 | * @return \WP_REST_Response |
133 | 133 | */ |
134 | - public function send_response( $response ) { |
|
135 | - if( $response instanceof Rest_Exception ) { |
|
136 | - $response = new \WP_Error( $response->get_string_code(), $response->getMessage(), $response->get_data() ); |
|
134 | + public function send_response($response) { |
|
135 | + if ($response instanceof Rest_Exception) { |
|
136 | + $response = new \WP_Error($response->get_string_code(), $response->getMessage(), $response->get_data()); |
|
137 | 137 | } |
138 | - if( $response instanceof \Exception ) { |
|
138 | + if ($response instanceof \Exception) { |
|
139 | 139 | $code = $response->getCode() ? $response->getCode() : 'error_occurred'; |
140 | - $response = new \WP_Error( $code, $response->getMessage() ); |
|
140 | + $response = new \WP_Error($code, $response->getMessage()); |
|
141 | 141 | } |
142 | - if( $response instanceof \WP_Error ) { |
|
143 | - $response = $this->_add_ee_errors_to_response( $response ); |
|
144 | - $rest_response = $this->_create_rest_response_from_wp_error( $response ); |
|
145 | - }else{ |
|
146 | - $rest_response = new \WP_REST_Response( $response, 200 ); |
|
142 | + if ($response instanceof \WP_Error) { |
|
143 | + $response = $this->_add_ee_errors_to_response($response); |
|
144 | + $rest_response = $this->_create_rest_response_from_wp_error($response); |
|
145 | + } else { |
|
146 | + $rest_response = new \WP_REST_Response($response, 200); |
|
147 | 147 | } |
148 | 148 | $headers = array(); |
149 | - if( $this->_debug_mode && is_array( $this->_debug_info ) ) { |
|
150 | - foreach( $this->_debug_info as $debug_key => $debug_info ) { |
|
151 | - if( is_array( $debug_info ) ) { |
|
152 | - $debug_info = json_encode( $debug_info ); |
|
149 | + if ($this->_debug_mode && is_array($this->_debug_info)) { |
|
150 | + foreach ($this->_debug_info as $debug_key => $debug_info) { |
|
151 | + if (is_array($debug_info)) { |
|
152 | + $debug_info = json_encode($debug_info); |
|
153 | 153 | } |
154 | - $headers[ 'X-EE4-Debug-' . ucwords( $debug_key ) ] = $debug_info; |
|
154 | + $headers['X-EE4-Debug-'.ucwords($debug_key)] = $debug_info; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | $headers = array_merge( |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $this->_get_headers_from_ee_notices() |
161 | 161 | ); |
162 | 162 | |
163 | - $rest_response->set_headers( $headers ); |
|
163 | + $rest_response->set_headers($headers); |
|
164 | 164 | return $rest_response; |
165 | 165 | } |
166 | 166 | |
@@ -171,31 +171,31 @@ discard block |
||
171 | 171 | * @param \WP_Error $wp_error |
172 | 172 | * @return \WP_REST_Response |
173 | 173 | */ |
174 | - protected function _create_rest_response_from_wp_error( \WP_Error $wp_error ) { |
|
174 | + protected function _create_rest_response_from_wp_error(\WP_Error $wp_error) { |
|
175 | 175 | $error_data = $wp_error->get_error_data(); |
176 | - if ( is_array( $error_data ) && isset( $error_data['status'] ) ) { |
|
176 | + if (is_array($error_data) && isset($error_data['status'])) { |
|
177 | 177 | $status = $error_data['status']; |
178 | 178 | } else { |
179 | 179 | $status = 500; |
180 | 180 | } |
181 | 181 | |
182 | 182 | $errors = array(); |
183 | - foreach ( (array) $wp_error->errors as $code => $messages ) { |
|
184 | - foreach ( (array) $messages as $message ) { |
|
183 | + foreach ((array) $wp_error->errors as $code => $messages) { |
|
184 | + foreach ((array) $messages as $message) { |
|
185 | 185 | $errors[] = array( |
186 | 186 | 'code' => $code, |
187 | 187 | 'message' => $message, |
188 | - 'data' => $wp_error->get_error_data( $code ) |
|
188 | + 'data' => $wp_error->get_error_data($code) |
|
189 | 189 | ); |
190 | 190 | } |
191 | 191 | } |
192 | - $data = isset( $errors[0] ) ? $errors[0] : array(); |
|
193 | - if ( count( $errors ) > 1 ) { |
|
192 | + $data = isset($errors[0]) ? $errors[0] : array(); |
|
193 | + if (count($errors) > 1) { |
|
194 | 194 | // Remove the primary error. |
195 | - array_shift( $errors ); |
|
195 | + array_shift($errors); |
|
196 | 196 | $data['additional_errors'] = $errors; |
197 | 197 | } |
198 | - return new \WP_REST_Response( $data, $status ); |
|
198 | + return new \WP_REST_Response($data, $status); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | protected function _get_headers_from_ee_notices() { |
206 | 206 | $headers = array(); |
207 | 207 | $notices = \EE_Error::get_raw_notices(); |
208 | - foreach( $notices as $notice_type => $sub_notices ) { |
|
209 | - if( ! is_array( $sub_notices ) ) { |
|
208 | + foreach ($notices as $notice_type => $sub_notices) { |
|
209 | + if ( ! is_array($sub_notices)) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | - foreach( $sub_notices as $notice_code => $sub_notice ) { |
|
213 | - $headers[ 'X-EE4-Notices-' . \EEH_Inflector::humanize( $notice_type ) . '[' . $notice_code . ']' ] = strip_tags( $sub_notice ); |
|
212 | + foreach ($sub_notices as $notice_code => $sub_notice) { |
|
213 | + $headers['X-EE4-Notices-'.\EEH_Inflector::humanize($notice_type).'['.$notice_code.']'] = strip_tags($sub_notice); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | return apply_filters( |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | * @param string $route |
229 | 229 | * @return string |
230 | 230 | */ |
231 | - public function get_requested_version( $route = null ) { |
|
231 | + public function get_requested_version($route = null) { |
|
232 | 232 | $matches = $this->parse_route( |
233 | 233 | $route, |
234 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '~', |
|
235 | - array( 'version' ) |
|
234 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'~', |
|
235 | + array('version') |
|
236 | 236 | ); |
237 | - if( isset( $matches[ 'version' ] ) ) { |
|
238 | - return $matches[ 'version' ]; |
|
237 | + if (isset($matches['version'])) { |
|
238 | + return $matches['version']; |
|
239 | 239 | } else { |
240 | 240 | return \EED_Core_Rest_Api::latest_rest_api_version(); |
241 | 241 | } |
@@ -260,23 +260,23 @@ discard block |
||
260 | 260 | * array( 'model' => 'foo', 'id' => 'bar' ) |
261 | 261 | * @throws \EE_Error if it couldn't be parsed |
262 | 262 | */ |
263 | - public function parse_route( $route, $regex, $match_keys ) { |
|
263 | + public function parse_route($route, $regex, $match_keys) { |
|
264 | 264 | $indexed_matches = array(); |
265 | - $success = preg_match( $regex, $route, $matches ); |
|
266 | - if( |
|
267 | - is_array( $matches ) ) { |
|
265 | + $success = preg_match($regex, $route, $matches); |
|
266 | + if ( |
|
267 | + is_array($matches) ) { |
|
268 | 268 | //skip the overall regex match. Who cares |
269 | - for( $i = 1; $i <= count( $match_keys ); $i++ ) { |
|
270 | - if( ! isset( $matches[ $i ] ) ) { |
|
269 | + for ($i = 1; $i <= count($match_keys); $i++) { |
|
270 | + if ( ! isset($matches[$i])) { |
|
271 | 271 | $success = false; |
272 | 272 | } else { |
273 | - $indexed_matches[ $match_keys[ $i - 1 ] ] = $matches[ $i ]; |
|
273 | + $indexed_matches[$match_keys[$i - 1]] = $matches[$i]; |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
277 | - if( ! $success ) { |
|
277 | + if ( ! $success) { |
|
278 | 278 | throw new \EE_Error( |
279 | - __( 'We could not parse the URL. Please contact Event Espresso Support', 'event_espresso' ), |
|
279 | + __('We could not parse the URL. Please contact Event Espresso Support', 'event_espresso'), |
|
280 | 280 | 'endpoint_parsing_error' |
281 | 281 | ); |
282 | 282 | } |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | * @since $VID:$ |
14 | 14 | * |
15 | 15 | */ |
16 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
17 | - exit( 'No direct script access allowed' ); |
|
16 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
17 | + exit('No direct script access allowed'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | class Base { |
21 | - protected static function _verify_current_user_can( $required_permission, $attempted_calculation ) { |
|
22 | - if( ! current_user_can( $required_permission ) ) { |
|
21 | + protected static function _verify_current_user_can($required_permission, $attempted_calculation) { |
|
22 | + if ( ! current_user_can($required_permission)) { |
|
23 | 23 | throw new Rest_Exception( |
24 | 24 | 'permission_denied', |
25 | 25 | sprintf( |
26 | - __( 'Permission denied, you cannot calculate %1$s on %2$s because you do not have the capability "%3$s"', 'event_espresso' ), |
|
26 | + __('Permission denied, you cannot calculate %1$s on %2$s because you do not have the capability "%3$s"', 'event_espresso'), |
|
27 | 27 | $attempted_calculation, |
28 | - \EEH_Inflector::pluralize_and_lower( self::get_resource_name() ), |
|
28 | + \EEH_Inflector::pluralize_and_lower(self::get_resource_name()), |
|
29 | 29 | $required_permission |
30 | 30 | ) |
31 | 31 | ); |
@@ -38,6 +38,6 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function get_resource_name() { |
40 | 40 | $classname = get_called_class(); |
41 | - return substr( $classname, strrpos( $classname, '\\' ) + 1 ); |
|
41 | + return substr($classname, strrpos($classname, '\\') + 1); |
|
42 | 42 | } |
43 | 43 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @since 4.8.35.rc.001 |
16 | 16 | * |
17 | 17 | */ |
18 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
19 | - exit( 'No direct script access allowed' ); |
|
18 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
19 | + exit('No direct script access allowed'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class Calculated_Model_Fields { |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * the WP_Request object, |
39 | 39 | * the controller object |
40 | 40 | */ |
41 | - public function mapping( $refresh = false ) { |
|
42 | - if( ! $this->_mapping || $refresh ) { |
|
41 | + public function mapping($refresh = false) { |
|
42 | + if ( ! $this->_mapping || $refresh) { |
|
43 | 43 | $this->_mapping = $this->_generate_new_mapping(); |
44 | 44 | } |
45 | 45 | return $this->_mapping; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function _generate_new_mapping() { |
54 | 54 | $rest_api_calculations_namespace = 'EventEspresso\core\libraries\rest_api\calculations\\'; |
55 | - $event_calculations_class = $rest_api_calculations_namespace . 'Event'; |
|
56 | - $datetime_calculations_class = $rest_api_calculations_namespace . 'Datetime'; |
|
55 | + $event_calculations_class = $rest_api_calculations_namespace.'Event'; |
|
56 | + $datetime_calculations_class = $rest_api_calculations_namespace.'Datetime'; |
|
57 | 57 | return apply_filters( |
58 | 58 | 'FHEE__EventEspresso\core\libraries\rest_api\Calculated_Model_Fields__mapping', |
59 | 59 | array( |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @param \EEM_Base $model |
82 | 82 | * @return array allowable values for this field |
83 | 83 | */ |
84 | - public function retrieve_calculated_fields_for_model( \EEM_Base $model ) { |
|
84 | + public function retrieve_calculated_fields_for_model(\EEM_Base $model) { |
|
85 | 85 | $mapping = $this->mapping(); |
86 | - if( isset( $mapping[ $model->get_this_model_name() ] ) ) { |
|
87 | - return array_keys( $mapping[ $model->get_this_model_name() ] ); |
|
86 | + if (isset($mapping[$model->get_this_model_name()])) { |
|
87 | + return array_keys($mapping[$model->get_this_model_name()]); |
|
88 | 88 | } else { |
89 | 89 | return array(); |
90 | 90 | } |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | * @return mixed|null |
104 | 104 | * @throws \EE_Error |
105 | 105 | */ |
106 | - public function retrieve_calculated_field_value( \EEM_Base $model, $field_name, $wpdb_row, $rest_request, Base $controller ) { |
|
106 | + public function retrieve_calculated_field_value(\EEM_Base $model, $field_name, $wpdb_row, $rest_request, Base $controller) { |
|
107 | 107 | $mapping = $this->mapping(); |
108 | - if( isset( $mapping[ $model->get_this_model_name() ] ) |
|
109 | - && isset( $mapping[ $model->get_this_model_name() ][ $field_name ] ) ) { |
|
110 | - $classname = $mapping[ $model->get_this_model_name() ][ $field_name ]; |
|
111 | - return call_user_func( array( $classname, $field_name ), $wpdb_row, $rest_request, $controller ); |
|
108 | + if (isset($mapping[$model->get_this_model_name()]) |
|
109 | + && isset($mapping[$model->get_this_model_name()][$field_name])) { |
|
110 | + $classname = $mapping[$model->get_this_model_name()][$field_name]; |
|
111 | + return call_user_func(array($classname, $field_name), $wpdb_row, $rest_request, $controller); |
|
112 | 112 | } |
113 | 113 | throw new Rest_Exception( |
114 | 114 | 'calculated_field_does_not_exist', |
115 | 115 | sprintf( |
116 | - __( 'There is no calculated field %1$s on resource %2$s', 'event_espresso' ), |
|
116 | + __('There is no calculated field %1$s on resource %2$s', 'event_espresso'), |
|
117 | 117 | $field_name, |
118 | 118 | $model->get_this_model_name() |
119 | 119 | ) |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | * @since $VID:$ |
14 | 14 | * |
15 | 15 | */ |
16 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
17 | - exit( 'No direct script access allowed' ); |
|
16 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
17 | + exit('No direct script access allowed'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | class Rest_Exception extends \EE_Error { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $_wp_error_data = array(); |
26 | 26 | protected $_wp_error_code = ''; |
27 | - public function __construct( $string_code, $message, $wp_error_data = array(), $previous = null ) { |
|
27 | + public function __construct($string_code, $message, $wp_error_data = array(), $previous = null) { |
|
28 | 28 | parent::__construct( |
29 | 29 | $message, |
30 | 30 | 500, |