@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 0 => array( |
34 | 34 | 'content_id' => 'attendee-column-tip', |
35 | 35 | 'target' => '.column-attendees .dashicons-groups', |
36 | - 'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ), |
|
36 | + 'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')), |
|
37 | 37 | 'options' => array( |
38 | 38 | 'position' => array( |
39 | 39 | 'my' => 'bottom left', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param EE_Datetime constant $status What status is set (by class) |
125 | 125 | * @return string The status legend with the related status highlighted |
126 | 126 | */ |
127 | - private function _event_status_legend( $status ) { |
|
127 | + private function _event_status_legend($status) { |
|
128 | 128 | |
129 | 129 | $status_array = array( |
130 | 130 | 'active_status' => EE_Datetime::active, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'inactive_status' => EE_Datetime::inactive |
137 | 137 | ); |
138 | 138 | |
139 | - return EEH_Template::status_legend( $status_array, $status ); |
|
139 | + return EEH_Template::status_legend($status_array, $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -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 | /** |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __construct() { |
36 | 36 | //define some page related constants |
37 | - define( 'EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
|
38 | - define( 'EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings' ); |
|
39 | - define( 'EE_MAINTENANCE_ADMIN_URL', admin_url( 'admin.php?page=' . EE_MAINTENANCE_PG_SLUG )); |
|
40 | - define( 'EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS ); |
|
41 | - define( 'EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS ); |
|
42 | - define( 'EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/' ); |
|
37 | + define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
|
38 | + define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings'); |
|
39 | + define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page='.EE_MAINTENANCE_PG_SLUG)); |
|
40 | + define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES.'maintenance'.DS); |
|
41 | + define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN.'templates'.DS); |
|
42 | + define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL.'maintenance/assets/'); |
|
43 | 43 | //check that if we're in maintenance mode that we tell the admin that |
44 | - add_action('admin_notices',array($this,'check_maintenance_mode')); |
|
44 | + add_action('admin_notices', array($this, 'check_maintenance_mode')); |
|
45 | 45 | parent::__construct(); |
46 | 46 | } |
47 | 47 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | protected function _set_menu_map() { |
53 | 53 | $menu_map = $this->_menu_map(); |
54 | 54 | |
55 | - $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ? new EE_Admin_Page_Main_Menu( $menu_map) : new EE_Admin_Page_Sub_Menu( $menu_map ); |
|
55 | + $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ? new EE_Admin_Page_Main_Menu($menu_map) : new EE_Admin_Page_Sub_Menu($menu_map); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function _menu_map() { |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | 'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG, |
68 | 68 | 'admin_init_page' => $this |
69 | 69 | ); |
70 | - if( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
71 | - $map['menu_group']='main'; |
|
70 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
71 | + $map['menu_group'] = 'main'; |
|
72 | 72 | $map['subtitle'] = EE_MAINTENANCE_LABEL; |
73 | - $map['menu_label'] = __( 'Event Espresso', 'event_espresso' ); |
|
73 | + $map['menu_label'] = __('Event Espresso', 'event_espresso'); |
|
74 | 74 | } |
75 | 75 | return $map; |
76 | 76 | } |
@@ -78,26 +78,26 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of maintenance mode |
80 | 80 | */ |
81 | - public function check_maintenance_mode(){ |
|
81 | + public function check_maintenance_mode() { |
|
82 | 82 | $notice = ''; |
83 | 83 | $maintenance_page_url = ''; |
84 | - if(EE_Maintenance_Mode::instance()->level()){ |
|
84 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
85 | 85 | $maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL); |
86 | - switch(EE_Maintenance_Mode::instance()->level()){ |
|
86 | + switch (EE_Maintenance_Mode::instance()->level()) { |
|
87 | 87 | case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
88 | 88 | $notice = '<div class="update-nag"> |
89 | - ' . sprintf(__("Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", "event_espresso"),"<a href='$maintenance_page_url'>","</a>"). |
|
89 | + ' . sprintf(__("Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", "event_espresso"), "<a href='$maintenance_page_url'>", "</a>"). |
|
90 | 90 | '</div>'; |
91 | 91 | break; |
92 | 92 | case EE_Maintenance_Mode::level_2_complete_maintenance: |
93 | - $notice = '<div class="error"> |
|
93 | + $notice = '<div class="error"> |
|
94 | 94 | <p>'. sprintf(__("As part of the process for updating Event Espresso, your database also |
95 | -needs to be updated. Event Espresso is in COMPLETE MAINTENANCE MODE (both WordPress admin pages and front-end event registration pages are disabled) until you run the database update script. %s Visit the Maintenance Page to get started,%s it only takes a moment.", "event_espresso"),"<a href='$maintenance_page_url'>","</a>"). |
|
95 | +needs to be updated. Event Espresso is in COMPLETE MAINTENANCE MODE (both WordPress admin pages and front-end event registration pages are disabled) until you run the database update script. %s Visit the Maintenance Page to get started,%s it only takes a moment.", "event_espresso"), "<a href='$maintenance_page_url'>", "</a>"). |
|
96 | 96 | '</div>'; |
97 | 97 | break; |
98 | 98 | } |
99 | 99 | } |
100 | - echo apply_filters( 'FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', $notice, $maintenance_page_url ); |
|
100 | + echo apply_filters('FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', $notice, $maintenance_page_url); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | } //end class Payments_Admin_Page_Init |
@@ -1,6 +1,7 @@ |
||
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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | private function _registration_trash_message() { |
95 | - return '<p>' . __('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>'; |
|
95 | + return '<p>'.__('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param EEM_Registration constant $status What status is set (by class) |
105 | 105 | * @return string The status legend with the related status highlighted |
106 | 106 | */ |
107 | - private function _registration_status_legend( $status ) { |
|
107 | + private function _registration_status_legend($status) { |
|
108 | 108 | |
109 | 109 | $status_array = array( |
110 | 110 | 'approved_status' => EEM_Registration::status_id_approved, |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | 'cancelled_status' => EEM_Registration::status_id_cancelled |
115 | 115 | ); |
116 | 116 | |
117 | - return EEH_Template::status_legend( $status_array, $status ); |
|
117 | + return EEH_Template::status_legend($status_array, $status); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct() { |
34 | 34 | |
35 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
36 | - if ( ! defined( 'TXN_PG_SLUG' ) ) { |
|
37 | - define( 'TXN_PG_SLUG', 'espresso_transactions' ); |
|
38 | - define( 'TXN_PG_NAME', ucwords( str_replace( '_', '', TXN_PG_SLUG ) ) ); |
|
39 | - define( 'TXN_ADMIN', EE_ADMIN_PAGES . 'transactions' . DS ); |
|
40 | - define( 'TXN_ADMIN_URL', admin_url( 'admin.php?page=' . TXN_PG_SLUG ) ); |
|
41 | - define( 'TXN_ASSETS_PATH', TXN_ADMIN . 'assets' . DS ); |
|
42 | - define( 'TXN_ASSETS_URL', str_replace( '\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets' . DS ) ); |
|
43 | - define( 'TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates' . DS ); |
|
44 | - define( 'TXN_TEMPLATE_URL', str_replace( '\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates' . DS ) ); |
|
35 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
36 | + if ( ! defined('TXN_PG_SLUG')) { |
|
37 | + define('TXN_PG_SLUG', 'espresso_transactions'); |
|
38 | + define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG))); |
|
39 | + define('TXN_ADMIN', EE_ADMIN_PAGES.'transactions'.DS); |
|
40 | + define('TXN_ADMIN_URL', admin_url('admin.php?page='.TXN_PG_SLUG)); |
|
41 | + define('TXN_ASSETS_PATH', TXN_ADMIN.'assets'.DS); |
|
42 | + define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/assets'.DS)); |
|
43 | + define('TXN_TEMPLATE_PATH', TXN_ADMIN.'templates'.DS); |
|
44 | + define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/templates'.DS)); |
|
45 | 45 | } |
46 | 46 | parent::__construct(); |
47 | 47 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | protected function _set_menu_map() { |
66 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
66 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
67 | 67 | 'menu_group' => 'main', |
68 | 68 | 'menu_order' => 50, |
69 | 69 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param EEM_Transaction constant $status What status is set (by class) |
84 | 84 | * @return string The status legend with the related status highlighted |
85 | 85 | */ |
86 | - private function _transaction_status_legend( $status ) { |
|
86 | + private function _transaction_status_legend($status) { |
|
87 | 87 | |
88 | 88 | $status_array = array( |
89 | 89 | 'overpaid' => EEM_Transaction::overpaid_status_code, |
@@ -92,6 +92,6 @@ discard block |
||
92 | 92 | 'failed' => EEM_Transaction::failed_status_code, |
93 | 93 | ); |
94 | 94 | |
95 | - return EEH_Template::status_legend( $status_array, $status ); |
|
95 | + return EEH_Template::status_legend($status_array, $status); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | /** |
204 | 204 | * column_REG_att_checked_in |
205 | - */ |
|
205 | + */ |
|
206 | 206 | function column__REG_att_checked_in(EE_Registration $item){ |
207 | 207 | $attendee = $item->attendee(); |
208 | 208 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * column_REG_final_price |
291 | - */ |
|
291 | + */ |
|
292 | 292 | function column__REG_final_price(EE_Registration $item){ |
293 | 293 | return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
294 | 294 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | /** |
301 | 301 | * column_TXN_paid |
302 | - */ |
|
302 | + */ |
|
303 | 303 | function column_TXN_paid(EE_Registration $item){ |
304 | 304 | |
305 | 305 | if ( $item->count() == 1 ) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | /** |
328 | 328 | * column_TXN_total |
329 | - */ |
|
329 | + */ |
|
330 | 330 | function column_TXN_total(EE_Registration $item){ |
331 | 331 | $txn = $item->transaction(); |
332 | 332 | $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - public function __construct( $admin_page ) { |
|
19 | + public function __construct($admin_page) { |
|
20 | 20 | parent::__construct($admin_page); |
21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array(); |
22 | 22 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | protected function _setup_data() { |
28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE ); |
|
29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE); |
|
28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE); |
|
29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _set_properties() { |
36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
37 | 37 | |
38 | 38 | $this->_wp_list_args = array( |
39 | 39 | 'singular' => __('registrant', 'event_espresso'), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $columns = array(); |
46 | 46 | //$columns['_Reg_Status'] = ''; |
47 | - if ( !empty( $evt_id ) ) { |
|
47 | + if ( ! empty($evt_id)) { |
|
48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
49 | 49 | $this->_has_checkbox_column = true; |
50 | 50 | } |
@@ -60,26 +60,26 @@ discard block |
||
60 | 60 | 'TXN_total' => __('Total', 'event_espresso') |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_columns = array_merge( $columns, $this->_columns); |
|
63 | + $this->_columns = array_merge($columns, $this->_columns); |
|
64 | 64 | |
65 | 65 | $this->_primary_column = '_REG_att_checked_in'; |
66 | 66 | |
67 | - if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id ) ) { |
|
67 | + if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { |
|
68 | 68 | $this->_bottom_buttons = array( |
69 | 69 | 'report'=> array( |
70 | 70 | 'route' => 'registrations_report', |
71 | 71 | 'extra_request' => |
72 | 72 | array( |
73 | 73 | 'EVT_ID'=> $evt_id, |
74 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
74 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
75 | 75 | ) |
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | 80 | //true means its already sorted |
81 | - 'ATT_name' => array( 'ATT_name' => TRUE ), |
|
82 | - 'Event' => array( 'Event.EVT.Name' => FALSE ) |
|
81 | + 'ATT_name' => array('ATT_name' => TRUE), |
|
82 | + 'Event' => array('Event.EVT.Name' => FALSE) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | $this->_hidden_columns = array(); |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | - protected function _get_row_class( $item ) { |
|
95 | - $class = parent::_get_row_class( $item ); |
|
94 | + protected function _get_row_class($item) { |
|
95 | + $class = parent::_get_row_class($item); |
|
96 | 96 | //add status class |
97 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
98 | - if ( $this->_has_checkbox_column ) { |
|
97 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
98 | + if ($this->_has_checkbox_column) { |
|
99 | 99 | $class .= ' has-checkbox-column'; |
100 | 100 | } |
101 | 101 | return $class; |
@@ -107,42 +107,42 @@ discard block |
||
107 | 107 | $filters = $where = array(); |
108 | 108 | |
109 | 109 | |
110 | - if ( empty( $this->_dtts_for_event ) ) { |
|
110 | + if (empty($this->_dtts_for_event)) { |
|
111 | 111 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
112 | 112 | //note possible capability restrictions |
113 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
114 | - $where['status**'] = array( '!=', 'private' ); |
|
113 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
114 | + $where['status**'] = array('!=', 'private'); |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
118 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
117 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
118 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
119 | 119 | } |
120 | 120 | |
121 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) ); |
|
122 | - $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
|
123 | - foreach ( $events as $evt ) { |
|
121 | + $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); |
|
122 | + $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); |
|
123 | + foreach ($events as $evt) { |
|
124 | 124 | //any registrations for this event? |
125 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
125 | + if ( ! $evt->get_count_of_all_registrations()) |
|
126 | 126 | continue; |
127 | 127 | $evts[] = array( |
128 | 128 | 'id' => $evt->ID(), |
129 | - 'text' => $evt->get( 'EVT_name' ), |
|
129 | + 'text' => $evt->get('EVT_name'), |
|
130 | 130 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '' |
131 | 131 | ); |
132 | 132 | } |
133 | 133 | $event_filter = '<div class="ee-event-filter">'; |
134 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts ); |
|
135 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>'; |
|
134 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); |
|
135 | + $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; |
|
136 | 136 | $event_filter .= '</div>'; |
137 | 137 | $filters[] = $event_filter; |
138 | 138 | |
139 | 139 | } else { |
140 | 140 | //DTT datetimes filter |
141 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
141 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
142 | 142 | $dtts = array(); |
143 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
144 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); |
|
145 | - $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); |
|
143 | + foreach ($this->_dtts_for_event as $dtt) { |
|
144 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time(); |
|
145 | + $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); |
|
146 | 146 | } |
147 | 147 | $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); |
148 | 148 | } |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | |
164 | 164 | |
165 | 165 | protected function _get_total_event_attendees() { |
166 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
167 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
166 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
167 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
168 | 168 | $query_params = array(); |
169 | - if ($EVT_ID){ |
|
170 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
169 | + if ($EVT_ID) { |
|
170 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
171 | 171 | } |
172 | 172 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime |
173 | - if ( $DTT_ID ) { |
|
173 | + if ($DTT_ID) { |
|
174 | 174 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
175 | 175 | } |
176 | - $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 ) ); |
|
176 | + $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)); |
|
177 | 177 | |
178 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
178 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
179 | 179 | |
180 | 180 | return EEM_Registration::instance()->count($query_params); |
181 | 181 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | - function column__Reg_Status( EE_Registration $item ) { |
|
190 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
189 | + function column__Reg_Status(EE_Registration $item) { |
|
190 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_cb($item) { |
198 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
198 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * column_REG_att_checked_in |
210 | 210 | */ |
211 | - function column__REG_att_checked_in(EE_Registration $item){ |
|
211 | + function column__REG_att_checked_in(EE_Registration $item) { |
|
212 | 212 | $attendee = $item->attendee(); |
213 | 213 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
214 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
214 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
215 | 215 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID); |
216 | 216 | $nonce = wp_create_nonce('checkin_nonce'); |
217 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
218 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : ''; |
|
217 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
218 | + $toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; |
|
219 | 219 | |
220 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
220 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
221 | 221 | |
222 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content; |
|
222 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -228,45 +228,45 @@ discard block |
||
228 | 228 | |
229 | 229 | function column_ATT_name(EE_Registration $item) { |
230 | 230 | $attendee = $item->attendee(); |
231 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
231 | + if ( ! $attendee instanceof EE_Attendee) { |
|
232 | 232 | return __('No contact record for this registration.', 'event_espresso'); |
233 | 233 | } |
234 | 234 | |
235 | 235 | // edit attendee link |
236 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
237 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); |
|
236 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
237 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); |
|
238 | 238 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; |
239 | 239 | |
240 | 240 | //add group details |
241 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size()); |
|
241 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
242 | 242 | |
243 | 243 | //add regcode |
244 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL ); |
|
244 | + $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); |
|
245 | 245 | $name_link .= '<br>'; |
246 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) |
|
247 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' |
|
246 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) |
|
247 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' |
|
248 | 248 | : $item->reg_code(); |
249 | 249 | |
250 | 250 | //status |
251 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
251 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
252 | 252 | |
253 | 253 | $actions = array(); |
254 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
255 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID; |
|
254 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
255 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; |
|
256 | 256 | |
257 | - if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { |
|
258 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
259 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; |
|
257 | + if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { |
|
258 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
259 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
263 | 263 | |
264 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link; |
|
264 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
268 | 268 | |
269 | - function column_ATT_email( EE_Registration $item ) { |
|
269 | + function column_ATT_email(EE_Registration $item) { |
|
270 | 270 | $attendee = $item->attendee(); |
271 | 271 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
272 | 272 | return $item->get_first_related('Attendee')->email(); |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | function column_Event(EE_Registration $item) { |
280 | 280 | try { |
281 | 281 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
282 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL ); |
|
283 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name(); |
|
284 | - } catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { |
|
285 | - $event_label = esc_html__( 'Unknown', 'event_espresso' ); |
|
282 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); |
|
283 | + $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); |
|
284 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
285 | + $event_label = esc_html__('Unknown', 'event_espresso'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $event_label; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | |
294 | 294 | |
295 | - function column_PRC_name(EE_Registration $item){ |
|
295 | + function column_PRC_name(EE_Registration $item) { |
|
296 | 296 | return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
297 | 297 | } |
298 | 298 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * column_REG_final_price |
306 | 306 | */ |
307 | - function column__REG_final_price(EE_Registration $item){ |
|
308 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
307 | + function column__REG_final_price(EE_Registration $item) { |
|
308 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
@@ -315,20 +315,20 @@ discard block |
||
315 | 315 | /** |
316 | 316 | * column_TXN_paid |
317 | 317 | */ |
318 | - function column_TXN_paid(EE_Registration $item){ |
|
318 | + function column_TXN_paid(EE_Registration $item) { |
|
319 | 319 | |
320 | - if ( $item->count() == 1 ) { |
|
320 | + if ($item->count() == 1) { |
|
321 | 321 | |
322 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
322 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
323 | 323 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
324 | 324 | } else { |
325 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
326 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
325 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
326 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
327 | 327 | <span class="reg-pad-rght"> |
328 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '"> |
|
329 | - ' . $item->transaction()->pretty_paid(). ' |
|
328 | + <a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"> |
|
329 | + ' . $item->transaction()->pretty_paid().' |
|
330 | 330 | </a> |
331 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
331 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
332 | 332 | } |
333 | 333 | } else { |
334 | 334 | return '<span class="reg-pad-rght"></span>'; |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | /** |
343 | 343 | * column_TXN_total |
344 | 344 | */ |
345 | - function column_TXN_total(EE_Registration $item){ |
|
345 | + function column_TXN_total(EE_Registration $item) { |
|
346 | 346 | $txn = $item->transaction(); |
347 | - $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
348 | - if ( $item->get('REG_count') == 1 ) { |
|
347 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
348 | + if ($item->get('REG_count') == 1) { |
|
349 | 349 | $line_total_obj = $txn->total_line_item(); |
350 | 350 | $txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); |
351 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
351 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
352 | 352 | } else { |
353 | 353 | return '<span class="reg-pad-rght"></span>'; |
354 | 354 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | |
4 | 6 | class EE_Event_Registrations_List_Table extends EE_Admin_List_Table { |
@@ -123,8 +125,9 @@ discard block |
||
123 | 125 | $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
124 | 126 | foreach ( $events as $evt ) { |
125 | 127 | //any registrations for this event? |
126 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
127 | - continue; |
|
128 | + if ( ! $evt->get_count_of_all_registrations() ) { |
|
129 | + continue; |
|
130 | + } |
|
128 | 131 | $evts[] = array( |
129 | 132 | 'id' => $evt->ID(), |
130 | 133 | 'text' => $evt->get( 'EVT_name' ), |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false) |
56 | 56 | ) |
57 | 57 | */ |
58 | -class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage{ |
|
58 | +class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage { |
|
59 | 59 | private $_old_table; |
60 | 60 | private $_new_table; |
61 | 61 | private $_option_table; |
62 | - function _migration_step($num_items=50){ |
|
62 | + function _migration_step($num_items = 50) { |
|
63 | 63 | global $wpdb; |
64 | 64 | $start_at_record = $this->count_records_migrated(); |
65 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$start_at_record,$num_items),ARRAY_A); |
|
65 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
66 | 66 | $items_actually_migrated = 0; |
67 | - foreach($rows as $question_row){ |
|
67 | + foreach ($rows as $question_row) { |
|
68 | 68 | $new_id = $this->_insert_new_question($question_row); |
69 | 69 | $this->get_migration_script()->set_mapping($this->_old_table, $question_row['id'], $this->_new_table, $new_id); |
70 | 70 | $items_actually_migrated++; |
71 | 71 | } |
72 | - if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){ |
|
72 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
73 | 73 | $this->set_completed(); |
74 | 74 | } |
75 | 75 | return $items_actually_migrated; |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $this->_option_table = $wpdb->prefix."esp_question_option"; |
88 | 88 | parent::__construct(); |
89 | 89 | } |
90 | - private function _insert_new_question($old_question){ |
|
90 | + private function _insert_new_question($old_question) { |
|
91 | 91 | global $wpdb; |
92 | 92 | //if this pretends to be a 'system' question, check if we already have a |
93 | 93 | //system question for that string. If so, pretend THAT new question |
94 | 94 | //is what we just isnerted |
95 | - if($old_question['system_name']){ |
|
96 | - $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s",$old_question['system_name']))); |
|
97 | - if($id_of_new_system_question){ |
|
95 | + if ($old_question['system_name']) { |
|
96 | + $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s", $old_question['system_name']))); |
|
97 | + if ($id_of_new_system_question) { |
|
98 | 98 | return $id_of_new_system_question; |
99 | 99 | } |
100 | 100 | //ok so this must be the first one. Carry on. |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | 'QST_deleted'=>false |
114 | 114 | ); |
115 | 115 | $datatypes = array( |
116 | - '%s',//QST_display_text |
|
117 | - '%s',//QST-admin_label |
|
118 | - '%s',//QST_system |
|
119 | - '%s',//QST_type |
|
120 | - '%d',//QST_required |
|
121 | - '%s',//QST_required_text |
|
122 | - '%d',//QST_order |
|
123 | - '%d',//QST_admin_only |
|
124 | - '%d',//QST_wp_user |
|
125 | - '%d',//QST_deleted |
|
116 | + '%s', //QST_display_text |
|
117 | + '%s', //QST-admin_label |
|
118 | + '%s', //QST_system |
|
119 | + '%s', //QST_type |
|
120 | + '%d', //QST_required |
|
121 | + '%s', //QST_required_text |
|
122 | + '%d', //QST_order |
|
123 | + '%d', //QST_admin_only |
|
124 | + '%d', //QST_wp_user |
|
125 | + '%d', //QST_deleted |
|
126 | 126 | ); |
127 | - $success = $wpdb->insert($this->_new_table,$cols_n_values,$datatypes); |
|
128 | - if ( ! $success){ |
|
127 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
128 | + if ( ! $success) { |
|
129 | 129 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes)); |
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | $new_id = $wpdb->insert_id; |
133 | 133 | //now take care of posisbly adding question options |
134 | - if(in_array($old_question['question_type'],array('DROPDOWN','SINGLE','MULTIPLE'))){ |
|
135 | - $options = explode(",",$old_question['response']); |
|
136 | - foreach($options as $option){ |
|
134 | + if (in_array($old_question['question_type'], array('DROPDOWN', 'SINGLE', 'MULTIPLE'))) { |
|
135 | + $options = explode(",", $old_question['response']); |
|
136 | + foreach ($options as $option) { |
|
137 | 137 | $this->_insert_question_option($option, $new_id); |
138 | 138 | } |
139 | 139 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $question_id |
147 | 147 | * @return int |
148 | 148 | */ |
149 | - private function _insert_question_option($option,$question_id){ |
|
149 | + private function _insert_question_option($option, $question_id) { |
|
150 | 150 | $option = trim($option); |
151 | 151 | global $wpdb; |
152 | 152 | $cols_n_values = array( |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | 'QSO_value'=>$option, |
155 | 155 | 'QSO_deleted'=>false |
156 | 156 | ); |
157 | - $datatypes= array( |
|
158 | - '%d',//QST_ID |
|
159 | - '%s',//QSO_value |
|
160 | - '%d',//QSO_deleted |
|
157 | + $datatypes = array( |
|
158 | + '%d', //QST_ID |
|
159 | + '%s', //QSO_value |
|
160 | + '%d', //QSO_deleted |
|
161 | 161 | ); |
162 | - $success = $wpdb->insert($this->_option_table,$cols_n_values,$datatypes); |
|
163 | - if ( ! $success ){ |
|
164 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
162 | + $success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes); |
|
163 | + if ( ! $success) { |
|
164 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option, 'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
165 | 165 | return 0; |
166 | 166 | } |
167 | 167 | return $wpdb->insert_id; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -12,68 +12,68 @@ discard block |
||
12 | 12 | * @author Mike Nelson |
13 | 13 | * |
14 | 14 | */ |
15 | -class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table{ |
|
16 | - function __construct(){ |
|
15 | +class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table { |
|
16 | + function __construct() { |
|
17 | 17 | global $wpdb; |
18 | - $this->_old_table = $wpdb->prefix . 'esp_line_item'; |
|
18 | + $this->_old_table = $wpdb->prefix.'esp_line_item'; |
|
19 | 19 | $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"'; |
20 | 20 | $this->_pretty_name = __('Event Sub-total line items', 'event_espresso'); |
21 | 21 | parent::__construct(); |
22 | 22 | } |
23 | - protected function _migrate_old_row( $line_item_row ) { |
|
23 | + protected function _migrate_old_row($line_item_row) { |
|
24 | 24 | global $wpdb; |
25 | 25 | //what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID |
26 | - $event_id = $wpdb->get_var( $wpdb->prepare( 'SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row[ 'TXN_ID' ] ) ); |
|
26 | + $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM '.$wpdb->prefix.'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
27 | 27 | $new_line_item_data = array( |
28 | - 'LIN_code' => 'event-' . $event_id, |
|
29 | - 'TXN_ID' => $line_item_row[ 'TXN_ID' ], |
|
30 | - 'LIN_name' => __( 'Event', 'event_espresso' ), |
|
31 | - 'LIN_desc' => $line_item_row[ 'LIN_desc' ], |
|
32 | - 'LIN_unit_price' => $line_item_row[ 'LIN_unit_price' ], |
|
33 | - 'LIN_percent' => $line_item_row[ 'LIN_percent' ], |
|
34 | - 'LIN_is_taxable' => $line_item_row[ 'LIN_is_taxable' ], |
|
35 | - 'LIN_order' => $line_item_row[ 'LIN_order' ], |
|
36 | - 'LIN_total' => $line_item_row[ 'LIN_total' ], |
|
37 | - 'LIN_quantity' => $line_item_row[ 'LIN_quantity' ], |
|
38 | - 'LIN_parent' => $line_item_row[ 'LIN_ID'], |
|
28 | + 'LIN_code' => 'event-'.$event_id, |
|
29 | + 'TXN_ID' => $line_item_row['TXN_ID'], |
|
30 | + 'LIN_name' => __('Event', 'event_espresso'), |
|
31 | + 'LIN_desc' => $line_item_row['LIN_desc'], |
|
32 | + 'LIN_unit_price' => $line_item_row['LIN_unit_price'], |
|
33 | + 'LIN_percent' => $line_item_row['LIN_percent'], |
|
34 | + 'LIN_is_taxable' => $line_item_row['LIN_is_taxable'], |
|
35 | + 'LIN_order' => $line_item_row['LIN_order'], |
|
36 | + 'LIN_total' => $line_item_row['LIN_total'], |
|
37 | + 'LIN_quantity' => $line_item_row['LIN_quantity'], |
|
38 | + 'LIN_parent' => $line_item_row['LIN_ID'], |
|
39 | 39 | 'LIN_type' => 'sub-total', |
40 | 40 | 'OBJ_type' => 'Event', |
41 | 41 | 'OBJ_ID' => $event_id, |
42 | 42 | ); |
43 | 43 | $new_line_item_datatypes = array( |
44 | - '%s',//LIN_code |
|
45 | - '%d',//TXN_ID |
|
46 | - '%s',//LIN_name |
|
47 | - '%s',//LIN_desc |
|
48 | - '%f',//LIN_unit_price |
|
49 | - '%f',//LIN_percent |
|
50 | - '%d',//LIN_is_taxable |
|
51 | - '%d',//LIN_order |
|
52 | - '%f',//LIN_total |
|
53 | - '%d',//LIN_quantity |
|
54 | - '%d',//LIN_parent |
|
55 | - '%s',//LIN_type |
|
56 | - '%s',//OBJ_type |
|
57 | - '%d',//OBJ_ID |
|
44 | + '%s', //LIN_code |
|
45 | + '%d', //TXN_ID |
|
46 | + '%s', //LIN_name |
|
47 | + '%s', //LIN_desc |
|
48 | + '%f', //LIN_unit_price |
|
49 | + '%f', //LIN_percent |
|
50 | + '%d', //LIN_is_taxable |
|
51 | + '%d', //LIN_order |
|
52 | + '%f', //LIN_total |
|
53 | + '%d', //LIN_quantity |
|
54 | + '%d', //LIN_parent |
|
55 | + '%s', //LIN_type |
|
56 | + '%s', //OBJ_type |
|
57 | + '%d', //OBJ_ID |
|
58 | 58 | ); |
59 | 59 | //insert the new event subtotal line item, pointing to this line item |
60 | - $success = $wpdb->insert( $this->_old_table, $new_line_item_data, $new_line_item_datatypes ); |
|
61 | - if( ! $success ) { |
|
62 | - $this->add_error( $this->_create_error_message_for_db_insertion( $this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes ) ); |
|
60 | + $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes); |
|
61 | + if ( ! $success) { |
|
62 | + $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes)); |
|
63 | 63 | } |
64 | 64 | $new_line_item_id = $wpdb->insert_id; |
65 | - $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row[ 'LIN_ID' ], $this->_old_table, $new_line_item_id ); |
|
65 | + $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id); |
|
66 | 66 | $query = $wpdb->prepare( |
67 | 67 | "UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100", |
68 | 68 | $new_line_item_id, |
69 | - $line_item_row[ 'LIN_ID' ], |
|
69 | + $line_item_row['LIN_ID'], |
|
70 | 70 | $new_line_item_id ); |
71 | - $success = $wpdb->query( $query ); |
|
72 | - if( $success === false ) { |
|
71 | + $success = $wpdb->query($query); |
|
72 | + if ($success === false) { |
|
73 | 73 | $this->add_error( |
74 | - sprintf( __( 'Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso' ), |
|
74 | + sprintf(__('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'), |
|
75 | 75 | $new_line_item_id, |
76 | - $line_item_row[ 'LIN_ID' ], |
|
76 | + $line_item_row['LIN_ID'], |
|
77 | 77 | $wpdb->last_error, |
78 | 78 | $query, |
79 | 79 | $success) ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param array $props_n_values |
23 | 23 | * @return EE_WP_User|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array() ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
25 | + public static function new_instance($props_n_values = array()) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
27 | + return $has_object ? $has_object : new self($props_n_values); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_WP_User |
35 | 35 | */ |
36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
37 | - return new self( $props_n_values, TRUE ); |
|
36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
37 | + return new self($props_n_values, TRUE); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return WP_User |
43 | 43 | */ |
44 | 44 | public function wp_user_obj() { |
45 | - if( ! $this->_wp_user_obj ) { |
|
46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
45 | + if ( ! $this->_wp_user_obj) { |
|
46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
47 | 47 | } |
48 | 48 | return $this->_wp_user_obj; |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $_SERVER['REQUEST_URI'] |
70 | 70 | ) |
71 | 71 | ), |
72 | - get_edit_user_link( $this->ID() ) |
|
72 | + get_edit_user_link($this->ID()) |
|
73 | 73 | ) |
74 | 74 | ); |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return string |
88 | 88 | */ |
89 | 89 | public function get_admin_overview_link() { |
90 | - return admin_url( 'users.php' ); |
|
90 | + return admin_url('users.php'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 |