Completed
Branch Gutenberg/event-attendees-bloc... (c8d45d)
by
unknown
76:01 queued 62:31
created
modules/ticket_selector/TicketDetails.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
             "display-{$this->cssId()}",
97 97
             'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js',
98 98
             '',
99
-            'rel="' . $this->cssId() . '"'
100
-        ) . \EEH_HTML::link(
99
+            'rel="'.$this->cssId().'"'
100
+        ).\EEH_HTML::link(
101 101
             '',
102 102
             sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '),
103 103
             esc_attr(
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             "hide-{$this->cssId()}",
110 110
             'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js',
111 111
             'display:none;',
112
-            'rel="' . $this->cssId() . '"'
112
+            'rel="'.$this->cssId().'"'
113 113
         );
114 114
     }
115 115
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         return \EEH_Template::locate_template(
164 164
             apply_filters(
165 165
                 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path',
166
-                TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php',
166
+                TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php',
167 167
                 $this->ticket
168 168
             ),
169 169
             $template_args
Please login to merge, or discard this patch.
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -17,198 +17,198 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * @var \EE_Ticket $ticket
22
-     */
23
-    protected $ticket;
24
-
25
-    /**
26
-     * @var \EE_Ticket_Selector_Config $template_settings
27
-     */
28
-    protected $template_settings;
29
-
30
-    /**
31
-     * @var string $date_format
32
-     */
33
-    protected $date_format;
34
-
35
-    /**
36
-     * @var string $time_format
37
-     */
38
-    protected $time_format;
39
-
40
-    /**
41
-     * @var boolean $event_is_expired
42
-     */
43
-    protected $event_is_expired;
44
-
45
-
46
-
47
-    /**
48
-     * TicketDetails constructor.
49
-     *
50
-     * @param \EE_Ticket                 $ticket
51
-     * @param \EE_Ticket_Selector_Config $template_settings
52
-     * @param array                      $template_args
53
-     */
54
-    public function __construct(
55
-        \EE_Ticket $ticket,
56
-        \EE_Ticket_Selector_Config $template_settings,
57
-        array $template_args
58
-    )
59
-    {
60
-        $this->ticket            = $ticket;
61
-        $this->template_settings = $template_settings;
62
-        $this->date_format       = $template_args['date_format'];
63
-        $this->time_format       = $template_args['time_format'];
64
-        $this->event_is_expired  = $template_args['event_is_expired'];
65
-    }
66
-
67
-
68
-
69
-    /**
70
-     * @return \EE_Ticket
71
-     */
72
-    public function getTicket()
73
-    {
74
-        return $this->ticket;
75
-    }
76
-
77
-
78
-
79
-    /**
80
-     * @return bool
81
-     */
82
-    public function showTicketDetails()
83
-    {
84
-        return $this->template_settings->show_ticket_details;
85
-    }
86
-
87
-
88
-
89
-    /**
90
-     * @return \EE_Ticket_Selector_Config
91
-     */
92
-    public function getTemplateSettings()
93
-    {
94
-        return $this->template_settings;
95
-    }
96
-
97
-
98
-
99
-    /**
100
-     * @return string
101
-     */
102
-    public function getDateFormat()
103
-    {
104
-        return $this->date_format;
105
-    }
106
-
107
-
108
-
109
-    /**
110
-     * @return string
111
-     */
112
-    public function getTimeFormat()
113
-    {
114
-        return $this->time_format;
115
-    }
116
-
117
-
118
-
119
-    /**
120
-     * @return string
121
-     */
122
-    public function getShowHideLinks()
123
-    {
124
-        if ( ! $this->showTicketDetails()) {
125
-            return '';
126
-        }
127
-        return \EEH_HTML::link(
128
-            '',
129
-            sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '),
130
-            esc_attr(
131
-                apply_filters(
132
-                    'FHEE__ticket_selector_chart_template__show_ticket_details_link_title',
133
-                    __('click to show additional ticket details', 'event_espresso')
134
-                )
135
-            ),
136
-            "display-{$this->cssId()}",
137
-            'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js',
138
-            '',
139
-            'rel="' . $this->cssId() . '"'
140
-        ) . \EEH_HTML::link(
141
-            '',
142
-            sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '),
143
-            esc_attr(
144
-                apply_filters(
145
-                    'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title',
146
-                    __('click to hide additional ticket details', 'event_espresso')
147
-                )
148
-            ),
149
-            "hide-{$this->cssId()}",
150
-            'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js',
151
-            'display:none;',
152
-            'rel="' . $this->cssId() . '"'
153
-        );
154
-    }
155
-
156
-
157
-
158
-    /**
159
-     * @return string
160
-     */
161
-    public function cssId()
162
-    {
163
-        return apply_filters(
164
-            'FHEE__ticket_selector_chart_template__ticket_details_css_id',
165
-            "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}"
166
-        );
167
-    }
168
-
169
-
170
-
171
-    /**
172
-     * @param float $ticket_price
173
-     * @param int   $remaining
174
-     * @param int   $cols
175
-     * @return string
176
-     */
177
-    public function display(
178
-        $ticket_price = 0.00,
179
-        $remaining,
180
-        $cols = 2
181
-    ) {
182
-        $template_args = array();
183
-        $template_args['ticket'] = $this->ticket;
184
-        $template_args['ticket_price'] = $ticket_price;
185
-        $template_args['remaining'] = $remaining;
186
-        $template_args['cols'] = $cols;
187
-        $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details;
188
-        $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns;
189
-        $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details');
190
-        $template_args['ticket_details_css_id'] = $this->cssId();
191
-        $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters(
192
-            'FHEE__ticket_selector_chart_template__display_ticket_price_details',
193
-            true
194
-        );
195
-        $template_args['price_breakdown_heading'] = apply_filters(
196
-            'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading',
197
-            esc_html__('Price', 'event_espresso')
198
-        );
199
-        $template_args['date_format'] = $this->date_format;
200
-        $template_args['time_format'] = $this->time_format;
201
-        $template_args['event_is_expired'] = $this->event_is_expired;
202
-
203
-        return \EEH_Template::locate_template(
204
-            apply_filters(
205
-                'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path',
206
-                TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php',
207
-                $this->ticket
208
-            ),
209
-            $template_args
210
-        );
211
-    }
20
+	/**
21
+	 * @var \EE_Ticket $ticket
22
+	 */
23
+	protected $ticket;
24
+
25
+	/**
26
+	 * @var \EE_Ticket_Selector_Config $template_settings
27
+	 */
28
+	protected $template_settings;
29
+
30
+	/**
31
+	 * @var string $date_format
32
+	 */
33
+	protected $date_format;
34
+
35
+	/**
36
+	 * @var string $time_format
37
+	 */
38
+	protected $time_format;
39
+
40
+	/**
41
+	 * @var boolean $event_is_expired
42
+	 */
43
+	protected $event_is_expired;
44
+
45
+
46
+
47
+	/**
48
+	 * TicketDetails constructor.
49
+	 *
50
+	 * @param \EE_Ticket                 $ticket
51
+	 * @param \EE_Ticket_Selector_Config $template_settings
52
+	 * @param array                      $template_args
53
+	 */
54
+	public function __construct(
55
+		\EE_Ticket $ticket,
56
+		\EE_Ticket_Selector_Config $template_settings,
57
+		array $template_args
58
+	)
59
+	{
60
+		$this->ticket            = $ticket;
61
+		$this->template_settings = $template_settings;
62
+		$this->date_format       = $template_args['date_format'];
63
+		$this->time_format       = $template_args['time_format'];
64
+		$this->event_is_expired  = $template_args['event_is_expired'];
65
+	}
66
+
67
+
68
+
69
+	/**
70
+	 * @return \EE_Ticket
71
+	 */
72
+	public function getTicket()
73
+	{
74
+		return $this->ticket;
75
+	}
76
+
77
+
78
+
79
+	/**
80
+	 * @return bool
81
+	 */
82
+	public function showTicketDetails()
83
+	{
84
+		return $this->template_settings->show_ticket_details;
85
+	}
86
+
87
+
88
+
89
+	/**
90
+	 * @return \EE_Ticket_Selector_Config
91
+	 */
92
+	public function getTemplateSettings()
93
+	{
94
+		return $this->template_settings;
95
+	}
96
+
97
+
98
+
99
+	/**
100
+	 * @return string
101
+	 */
102
+	public function getDateFormat()
103
+	{
104
+		return $this->date_format;
105
+	}
106
+
107
+
108
+
109
+	/**
110
+	 * @return string
111
+	 */
112
+	public function getTimeFormat()
113
+	{
114
+		return $this->time_format;
115
+	}
116
+
117
+
118
+
119
+	/**
120
+	 * @return string
121
+	 */
122
+	public function getShowHideLinks()
123
+	{
124
+		if ( ! $this->showTicketDetails()) {
125
+			return '';
126
+		}
127
+		return \EEH_HTML::link(
128
+			'',
129
+			sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '),
130
+			esc_attr(
131
+				apply_filters(
132
+					'FHEE__ticket_selector_chart_template__show_ticket_details_link_title',
133
+					__('click to show additional ticket details', 'event_espresso')
134
+				)
135
+			),
136
+			"display-{$this->cssId()}",
137
+			'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js',
138
+			'',
139
+			'rel="' . $this->cssId() . '"'
140
+		) . \EEH_HTML::link(
141
+			'',
142
+			sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '),
143
+			esc_attr(
144
+				apply_filters(
145
+					'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title',
146
+					__('click to hide additional ticket details', 'event_espresso')
147
+				)
148
+			),
149
+			"hide-{$this->cssId()}",
150
+			'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js',
151
+			'display:none;',
152
+			'rel="' . $this->cssId() . '"'
153
+		);
154
+	}
155
+
156
+
157
+
158
+	/**
159
+	 * @return string
160
+	 */
161
+	public function cssId()
162
+	{
163
+		return apply_filters(
164
+			'FHEE__ticket_selector_chart_template__ticket_details_css_id',
165
+			"tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}"
166
+		);
167
+	}
168
+
169
+
170
+
171
+	/**
172
+	 * @param float $ticket_price
173
+	 * @param int   $remaining
174
+	 * @param int   $cols
175
+	 * @return string
176
+	 */
177
+	public function display(
178
+		$ticket_price = 0.00,
179
+		$remaining,
180
+		$cols = 2
181
+	) {
182
+		$template_args = array();
183
+		$template_args['ticket'] = $this->ticket;
184
+		$template_args['ticket_price'] = $ticket_price;
185
+		$template_args['remaining'] = $remaining;
186
+		$template_args['cols'] = $cols;
187
+		$template_args['show_ticket_details'] = $this->template_settings->show_ticket_details;
188
+		$template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns;
189
+		$template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details');
190
+		$template_args['ticket_details_css_id'] = $this->cssId();
191
+		$template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters(
192
+			'FHEE__ticket_selector_chart_template__display_ticket_price_details',
193
+			true
194
+		);
195
+		$template_args['price_breakdown_heading'] = apply_filters(
196
+			'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading',
197
+			esc_html__('Price', 'event_espresso')
198
+		);
199
+		$template_args['date_format'] = $this->date_format;
200
+		$template_args['time_format'] = $this->time_format;
201
+		$template_args['event_is_expired'] = $this->event_is_expired;
202
+
203
+		return \EEH_Template::locate_template(
204
+			apply_filters(
205
+				'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path',
206
+				TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php',
207
+				$this->ticket
208
+			),
209
+			$template_args
210
+		);
211
+	}
212 212
 
213 213
 }
214 214
 // End of file TicketDetails.php
Please login to merge, or discard this patch.
support/templates/support_admin_details_contact_support.template.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<h3><?php esc_html_e('Need help with Event Espresso?', 'event_espresso'); ?></h3>
3 3
 	
4
-	<h4><?php esc_html_e( 'You may be able to find an answer for your question or concern here:', 'event_espresso' ); ?></h4>
4
+	<h4><?php esc_html_e('You may be able to find an answer for your question or concern here:', 'event_espresso'); ?></h4>
5 5
 				<ol>
6
-					<li><strong><em><?php esc_html_e( 'A known issue.', 'event_espresso' ); ?></em></strong>  <?php printf( esc_html__( 'Some themes and plugins have %1$sknown conflicts%2$s with Event Espresso. (You can also browse the %3$sEvent Espresso support pages%2$s or %4$sEvent Espresso support forums%2$s to see if other members have experienced and solved the problem.)', 'event_espresso' ), '<a href="https://eventespresso.com/wiki/known-third-party-plugin-theme-conflicts/" target="_blank">','</a>', '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4" target="_blank">', '<a href="https://eventespresso.com/support/forums/" target="_blank">' ); ?></li>
7
-					<li><strong><em><?php esc_html_e( 'A plugin conflict.', 'event_espresso' ); ?></em></strong>  <?php esc_html_e( 'You can check to see if there is a plugin conflict by temporarily deactivating all plugins except for Event Espresso. If the problem goes away, then reactivate your plugins one by one until the issue returns. This will help you pinpoint the source of the conflict.', 'event_espresso' ); ?></li>
6
+					<li><strong><em><?php esc_html_e('A known issue.', 'event_espresso'); ?></em></strong>  <?php printf(esc_html__('Some themes and plugins have %1$sknown conflicts%2$s with Event Espresso. (You can also browse the %3$sEvent Espresso support pages%2$s or %4$sEvent Espresso support forums%2$s to see if other members have experienced and solved the problem.)', 'event_espresso'), '<a href="https://eventespresso.com/wiki/known-third-party-plugin-theme-conflicts/" target="_blank">', '</a>', '<a href="https://eventespresso.com/support/documentation/versioned-docs/?doc_ver=ee4" target="_blank">', '<a href="https://eventespresso.com/support/forums/" target="_blank">'); ?></li>
7
+					<li><strong><em><?php esc_html_e('A plugin conflict.', 'event_espresso'); ?></em></strong>  <?php esc_html_e('You can check to see if there is a plugin conflict by temporarily deactivating all plugins except for Event Espresso. If the problem goes away, then reactivate your plugins one by one until the issue returns. This will help you pinpoint the source of the conflict.', 'event_espresso'); ?></li>
8 8
 					<li>
9
-						<strong><em><?php esc_html_e( 'A theme conflict.', 'event_espresso' ); ?></em></strong>
9
+						<strong><em><?php esc_html_e('A theme conflict.', 'event_espresso'); ?></em></strong>
10 10
 						<?php
11
-							$default_theme = wp_get_theme( WP_DEFAULT_THEME );
11
+							$default_theme = wp_get_theme(WP_DEFAULT_THEME);
12 12
 
13
-							if ( $default_theme->exists() ) {
14
-								 printf( esc_html__( 'If your problem is not a known issue or caused by a plugin, then try activating %s (the default WordPress theme).', 'event_espresso' ), $default_theme->get( 'Name' ) );
13
+							if ($default_theme->exists()) {
14
+								 printf(esc_html__('If your problem is not a known issue or caused by a plugin, then try activating %s (the default WordPress theme).', 'event_espresso'), $default_theme->get('Name'));
15 15
 							} else {
16
-								esc_html_e( 'If your problem is not a known issue or caused by a plugin, then try activating the default WordPress theme.', 'event_espresso' );
16
+								esc_html_e('If your problem is not a known issue or caused by a plugin, then try activating the default WordPress theme.', 'event_espresso');
17 17
 							}
18 18
 						?>
19
-						<?php esc_html_e( 'If this solves the problem for you, then something in your theme is causing this issue. Check to see if an update is available for your WordPress theme or reach out to the theme author.', 'event_espresso' ); ?>
19
+						<?php esc_html_e('If this solves the problem for you, then something in your theme is causing this issue. Check to see if an update is available for your WordPress theme or reach out to the theme author.', 'event_espresso'); ?>
20 20
 					</li>
21 21
 				</ol>
22 22
 				
23
-	<p><?php esc_html_e( 'If none of the suggestions above help you find a solution, then feel free to reach out to the support team at Event Espresso.', 'event_espresso' ); ?></p>
24
-	<p><?php printf( esc_html__( 'Login to your account on EventEspresso.com and %1$screate a support post in our member support forums%2$s. Use a %3$sclear and descriptive title%4$s in your support post, %3$sdescribe the issue to the best of your knowledge%4$s, and %3$snever post any sensitive information such as login details%4$s. Be sure to also include %5$simportant information in the section below%2$s about your WordPress site.', 'event_espresso' ), '<a href="https://eventespresso.com/support/forums/" target="_blank">','</a>','<strong>','</strong>','<a href="#espresso_important_information_settings">' ); ?></p>
23
+	<p><?php esc_html_e('If none of the suggestions above help you find a solution, then feel free to reach out to the support team at Event Espresso.', 'event_espresso'); ?></p>
24
+	<p><?php printf(esc_html__('Login to your account on EventEspresso.com and %1$screate a support post in our member support forums%2$s. Use a %3$sclear and descriptive title%4$s in your support post, %3$sdescribe the issue to the best of your knowledge%4$s, and %3$snever post any sensitive information such as login details%4$s. Be sure to also include %5$simportant information in the section below%2$s about your WordPress site.', 'event_espresso'), '<a href="https://eventespresso.com/support/forums/" target="_blank">', '</a>', '<strong>', '</strong>', '<a href="#espresso_important_information_settings">'); ?></p>
25 25
 
26
-	<h4><?php esc_html_e( 'Have an emergency?', 'event_espresso' ); ?></h4>
26
+	<h4><?php esc_html_e('Have an emergency?', 'event_espresso'); ?></h4>
27 27
 
28
-	<p><?php printf( esc_html__( 'We offer support tokens to members that need help with a time-sensitive issue. A support token will provide you with up to 30 minutes of one-on-one time with a team member at Event Espresso. If you have an emergency and need help quickly, then please %1$spurchase a support token%2$s.', 'event_espresso' ), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">','</a>' ); ?></p>
28
+	<p><?php printf(esc_html__('We offer support tokens to members that need help with a time-sensitive issue. A support token will provide you with up to 30 minutes of one-on-one time with a team member at Event Espresso. If you have an emergency and need help quickly, then please %1$spurchase a support token%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/product/premium-support-token/?utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=help_support_tab&utm_content=support_token" target="_blank">', '</a>'); ?></p>
29 29
 </div>
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/support/templates/developers_admin_details.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<?php esc_html_e( 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', 'event_espresso' ); ?>
3
-	<h2><?php esc_html_e( 'Developer Resources', 'event_espresso' ); ?></h2>
2
+	<?php esc_html_e('If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', 'event_espresso'); ?>
3
+	<h2><?php esc_html_e('Developer Resources', 'event_espresso'); ?></h2>
4 4
 	<ul>
5
-		<li><?php printf( esc_html__( '%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank">','</a>' ); ?></li>
6
-		<li><?php printf( esc_html__( '%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso' ), '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li>
7
-		<li><?php printf( esc_html__( '%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>','<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' ); ?></li>
5
+		<li><?php printf(esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank">', '</a>'); ?></li>
6
+		<li><?php printf(esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li>
7
+		<li><?php printf(esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>', '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">'); ?></li>
8 8
 	</ul>
9 9
 
10
-	<h2><?php esc_html_e( 'Event Espresso 4 Articles for Developers', 'event_espresso' ); ?></h2>
10
+	<h2><?php esc_html_e('Event Espresso 4 Articles for Developers', 'event_espresso'); ?></h2>
11 11
 	<ul>
12
-		<li><?php printf( esc_html__( '%1$sCustom Post Types Usage%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li>
13
-		<li><?php printf( esc_html__( '%1$sTheme Development%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li>
14
-		<li><?php printf( esc_html__( '%1$sCapability System%2$s', 'event_espresso' ), '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li>
15
-		<li><?php printf( esc_html__( '%1$sPayment Method Development%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank">','</a>' ); ?></li>
16
-		<li><?php printf( esc_html__( '%1$sMessages System in Event Espresso 4%2$s', 'event_espresso' ), '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li>
17
-		<li><?php printf( esc_html__( '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', 'event_espresso' ), '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">','</a>' ); ?></li>
12
+		<li><?php printf(esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li>
13
+		<li><?php printf(esc_html__('%1$sTheme Development%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li>
14
+		<li><?php printf(esc_html__('%1$sCapability System%2$s', 'event_espresso'), '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li>
15
+		<li><?php printf(esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank">', '</a>'); ?></li>
16
+		<li><?php printf(esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li>
17
+		<li><?php printf(esc_html__('%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', 'event_espresso'), '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', '</a>'); ?></li>
18 18
 	</ul>
19 19
 	
20
-	<h2><?php esc_html_e( 'REST API Resources', 'event_espresso' ); ?></h2>
20
+	<h2><?php esc_html_e('REST API Resources', 'event_espresso'); ?></h2>
21 21
 	<ul>
22
-		<li><?php printf( esc_html__( '%1$sREST API: Introduction%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank">','</a>' ); ?></li>
23
-		<li><?php printf( esc_html__( '%1$sREST API: Reading Data%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank">','</a>' ); ?></li>
24
-		<li><?php printf( esc_html__( '%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso' ), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank">','</a>' ); ?></li>
22
+		<li><?php printf(esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank">', '</a>'); ?></li>
23
+		<li><?php printf(esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank">', '</a>'); ?></li>
24
+		<li><?php printf(esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank">', '</a>'); ?></li>
25 25
 	</ul>
26 26
 </div>
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
templates/reg_admin_details_main_meta_box_reg_details.template.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@
 block discarded – undo
1 1
 <div id="admin-primary-mbox-reg-details-dv" class="admin-primary-mbox-dv">
2 2
 
3
-	<?php do_action( 'AHEE__reg_admin_details_main_meta_box_reg_details__top', $REG_ID ); ?>
3
+	<?php do_action('AHEE__reg_admin_details_main_meta_box_reg_details__top', $REG_ID); ?>
4 4
 	<?php echo $resend_registration_button; ?>
5 5
 	<?php echo $view_transaction_button; ?>
6 6
 	<br/>
7 7
 
8
-	<h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span><?php _e( 'Registration Items', 'event_espresso' );?></h3>
8
+	<h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span><?php _e('Registration Items', 'event_espresso'); ?></h3>
9 9
 
10 10
 	<?php echo $line_item_table; ?>
11 11
 
12 12
 	<a id="display-additional-registration-session-info" class="display-the-hidden smaller-text" rel="additional-registration-session-info">
13
-		<span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional registration session details', 'event_espresso' );?>
13
+		<span class="dashicons dashicons-plus-alt"></span><?php _e('view additional registration session details', 'event_espresso'); ?>
14 14
 	</a>
15 15
 
16 16
 	<div id="additional-registration-session-info-dv" class="hidden">
17 17
 
18 18
 		<a id="hide-additional-registration-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-registration-session-info">
19
-			<span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional registration session details', 'event_espresso' );?>
19
+			<span class="dashicons dashicons-dismiss"></span><?php _e('hide additional registration session details', 'event_espresso'); ?>
20 20
 		</a>
21 21
 	<br class="clear"/>
22 22
 
23
-		<h3 class="admin-primary-mbox-h4"><?php _e( 'Registration Session Details', 'event_espresso' );?></h3>
23
+		<h3 class="admin-primary-mbox-h4"><?php _e('Registration Session Details', 'event_espresso'); ?></h3>
24 24
 
25 25
 		<table id="admin-primary-mbox-reg-extra-session-info-tbl" class="form-table skinny-rows">
26 26
 			<tbody>
27
-			<?php foreach ( $reg_details as $key => $reg_detail ) : ?>
27
+			<?php foreach ($reg_details as $key => $reg_detail) : ?>
28 28
 				<tr>
29 29
 					<th>
30
-						<label for="<?php echo $key;?>"><?php echo $reg_detail['label'];?></label>
30
+						<label for="<?php echo $key; ?>"><?php echo $reg_detail['label']; ?></label>
31 31
 					</th>
32 32
 					<td>
33
-						<?php echo $reg_detail['value'];?>
33
+						<?php echo $reg_detail['value']; ?>
34 34
 					</td>
35 35
 				</tr>
36 36
 			<?php endforeach; // $reg_details?>
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/RegistrationsReport.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -418,7 +418,7 @@
 block discarded – undo
418 418
      * In this case, we delete the temporary file
419 419
      *
420 420
      * @param JobParameters $job_parameters
421
-     * @return boolean
421
+     * @return JobStepResponse
422 422
      */
423 423
     public function cleanup_job(JobParameters $job_parameters)
424 424
     {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@
 block discarded – undo
174 174
                 $job_parameters->extra_datum('query_params'));
175 175
             \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
176 176
             $units_processed = count($csv_data);
177
-        }else{
177
+        } else{
178 178
             $units_processed = 0;
179 179
         }
180 180
         $job_parameters->mark_processed($units_processed);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 array_diff_key(
84 84
                     $query_params,
85 85
                     array_flip(
86
-                        array( 'limit' )
86
+                        array('limit')
87 87
                     )
88 88
                 )
89 89
             )
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
             );
131 131
         }
132 132
         $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping()));
133
-        if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) {
133
+        if (apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) {
134 134
             $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL');
135 135
         }
136
-        $question_query_params['group_by'] = array( 'QST_ID' );
137
-        return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
136
+        $question_query_params['group_by'] = array('QST_ID');
137
+        return array_unique(\EEM_Question::instance()->get_col($question_query_params, 'QST_admin_label'));
138 138
     }
139 139
 
140 140
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
154 154
             } else {
155 155
                 //it's a normal where condition
156
-                $question_where_params['Question_Group.Event.Registration.' . $key] = $val;
156
+                $question_where_params['Question_Group.Event.Registration.'.$key] = $val;
157 157
             }
158 158
         }
159 159
         return $question_where_params;
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function continue_job(JobParameters $job_parameters, $batch_size = 50)
173 173
     {
174
-        if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
174
+        if ($job_parameters->units_processed() < $job_parameters->job_size()) {
175 175
             $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
176 176
                 $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
177 177
                 $job_parameters->extra_datum('query_params'));
178 178
             \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
179 179
             $units_processed = count($csv_data);
180
-        }else{
180
+        } else {
181 181
             $units_processed = 0;
182 182
         }
183 183
         $job_parameters->mark_processed($units_processed);
Please login to merge, or discard this patch.
Indentation   +414 added lines, -415 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
18 18
 
19 19
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
-    exit('No direct script access allowed');
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -25,443 +25,442 @@  discard block
 block discarded – undo
25 25
 class RegistrationsReport extends JobHandlerFile
26 26
 {
27 27
 
28
-    /**
29
-     * Performs any necessary setup for starting the job. This is also a good
30
-     * place to setup the $job_arguments which will be used for subsequent HTTP requests
31
-     * when continue_job will be called
32
-     *
33
-     * @param JobParameters $job_parameters
34
-     * @throws BatchRequestException
35
-     * @return JobStepResponse
36
-     */
37
-    public function create_job(JobParameters $job_parameters)
38
-    {
39
-        $event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
-        if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41
-            throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso'));
42
-        }
43
-        $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(),
44
-            $this->get_filename($event_id));
45
-        $job_parameters->add_extra_data('filepath', $filepath);
46
-        if ($job_parameters->request_datum('use_filters', false)) {
47
-            $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array())));
48
-        } else {
49
-            $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array(
50
-                array(
51
-                    'OR'                 => array(
52
-                        //don't include registrations from failed or abandoned transactions...
53
-                        'Transaction.STS_ID' => array(
54
-                            'NOT IN',
55
-                            array(
56
-                                \EEM_Transaction::failed_status_code,
57
-                                \EEM_Transaction::abandoned_status_code,
58
-                            ),
59
-                        ),
60
-                        //unless the registration is approved, in which case include it regardless of transaction status
61
-                        'STS_ID'             => \EEM_Registration::status_id_approved,
62
-                    ),
63
-                    'Ticket.TKT_deleted' => array('IN', array(true, false)),
64
-                ),
65
-                'order_by'   => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'),
66
-                'force_join' => array('Transaction', 'Ticket', 'Attendee'),
67
-                'caps'       => \EEM_Base::caps_read_admin,
68
-            ), $event_id);
69
-            if ($event_id) {
70
-                $query_params[0]['EVT_ID'] = $event_id;
71
-            } else {
72
-                $query_params['force_join'][] = 'Event';
73
-            }
74
-        }
75
-        if ( ! isset($query_params['force_join'])) {
76
-            $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee');
77
-        }
78
-        $job_parameters->add_extra_data('query_params', $query_params);
79
-        $question_labels = $this->_get_question_labels($query_params);
80
-        $job_parameters->add_extra_data('question_labels', $question_labels);
81
-        $job_parameters->set_job_size(
82
-            \EEM_Registration::instance()->count(
83
-                array_diff_key(
84
-                    $query_params,
85
-                    array_flip(
86
-                        array( 'limit' )
87
-                    )
88
-                )
89
-            )
90
-        );
91
-        //we should also set the header columns
92
-        $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'),
93
-            $job_parameters->extra_datum('query_params'));
94
-        \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
95
-        //if we actually processed a row there, record it
96
-        if ($job_parameters->job_size()) {
97
-            $job_parameters->mark_processed(1);
98
-        }
99
-        return new JobStepResponse($job_parameters,
100
-            __('Registrations report started successfully...', 'event_espresso'));
101
-    }
28
+	/**
29
+	 * Performs any necessary setup for starting the job. This is also a good
30
+	 * place to setup the $job_arguments which will be used for subsequent HTTP requests
31
+	 * when continue_job will be called
32
+	 *
33
+	 * @param JobParameters $job_parameters
34
+	 * @throws BatchRequestException
35
+	 * @return JobStepResponse
36
+	 */
37
+	public function create_job(JobParameters $job_parameters)
38
+	{
39
+		$event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41
+			throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso'));
42
+		}
43
+		$filepath = $this->create_file_from_job_with_name($job_parameters->job_id(),
44
+			$this->get_filename($event_id));
45
+		$job_parameters->add_extra_data('filepath', $filepath);
46
+		if ($job_parameters->request_datum('use_filters', false)) {
47
+			$query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array())));
48
+		} else {
49
+			$query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array(
50
+				array(
51
+					'OR'                 => array(
52
+						//don't include registrations from failed or abandoned transactions...
53
+						'Transaction.STS_ID' => array(
54
+							'NOT IN',
55
+							array(
56
+								\EEM_Transaction::failed_status_code,
57
+								\EEM_Transaction::abandoned_status_code,
58
+							),
59
+						),
60
+						//unless the registration is approved, in which case include it regardless of transaction status
61
+						'STS_ID'             => \EEM_Registration::status_id_approved,
62
+					),
63
+					'Ticket.TKT_deleted' => array('IN', array(true, false)),
64
+				),
65
+				'order_by'   => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'),
66
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
67
+				'caps'       => \EEM_Base::caps_read_admin,
68
+			), $event_id);
69
+			if ($event_id) {
70
+				$query_params[0]['EVT_ID'] = $event_id;
71
+			} else {
72
+				$query_params['force_join'][] = 'Event';
73
+			}
74
+		}
75
+		if ( ! isset($query_params['force_join'])) {
76
+			$query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee');
77
+		}
78
+		$job_parameters->add_extra_data('query_params', $query_params);
79
+		$question_labels = $this->_get_question_labels($query_params);
80
+		$job_parameters->add_extra_data('question_labels', $question_labels);
81
+		$job_parameters->set_job_size(
82
+			\EEM_Registration::instance()->count(
83
+				array_diff_key(
84
+					$query_params,
85
+					array_flip(
86
+						array( 'limit' )
87
+					)
88
+				)
89
+			)
90
+		);
91
+		//we should also set the header columns
92
+		$csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'),
93
+			$job_parameters->extra_datum('query_params'));
94
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
95
+		//if we actually processed a row there, record it
96
+		if ($job_parameters->job_size()) {
97
+			$job_parameters->mark_processed(1);
98
+		}
99
+		return new JobStepResponse($job_parameters,
100
+			__('Registrations report started successfully...', 'event_espresso'));
101
+	}
102 102
 
103 103
 
104 104
 
105
-    /**
106
-     * Gets the filename
107
-     * @return string
108
-     */
109
-    protected function get_filename()
110
-    {
111
-        return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql')));
112
-    }
105
+	/**
106
+	 * Gets the filename
107
+	 * @return string
108
+	 */
109
+	protected function get_filename()
110
+	{
111
+		return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql')));
112
+	}
113 113
 
114 114
 
115 115
 
116
-    /**
117
-     * Gets the questions which are to be used for this report, so they
118
-     * can be remembered for later
119
-     *
120
-     * @param array $registration_query_params
121
-     * @return array question admin labels to be used for this report
122
-     */
123
-    protected function _get_question_labels($registration_query_params)
124
-    {
125
-        $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null;
126
-        $question_query_params = array();
127
-        if ($where !== null) {
128
-            $question_query_params = array(
129
-                $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130
-            );
131
-        }
132
-        $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping()));
133
-        if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) {
134
-            $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL');
135
-        }
136
-        $question_query_params['group_by'] = array( 'QST_ID' );
137
-        return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
138
-    }
116
+	/**
117
+	 * Gets the questions which are to be used for this report, so they
118
+	 * can be remembered for later
119
+	 *
120
+	 * @param array $registration_query_params
121
+	 * @return array question admin labels to be used for this report
122
+	 */
123
+	protected function _get_question_labels($registration_query_params)
124
+	{
125
+		$where = isset($registration_query_params[0]) ? $registration_query_params[0] : null;
126
+		$question_query_params = array();
127
+		if ($where !== null) {
128
+			$question_query_params = array(
129
+				$this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130
+			);
131
+		}
132
+		$question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping()));
133
+		if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) {
134
+			$question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL');
135
+		}
136
+		$question_query_params['group_by'] = array( 'QST_ID' );
137
+		return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
138
+	}
139 139
 
140 140
 
141 141
 
142
-    /**
143
-     * Takes where params meant for registrations and changes them to work for questions
144
-     *
145
-     * @param array $reg_where_params
146
-     * @return array
147
-     */
148
-    protected function _change_registration_where_params_to_question_where_params($reg_where_params)
149
-    {
150
-        $question_where_params = array();
151
-        foreach ($reg_where_params as $key => $val) {
152
-            if (\EEM_Registration::instance()->is_logic_query_param_key($key)) {
153
-                $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
154
-            } else {
155
-                //it's a normal where condition
156
-                $question_where_params['Question_Group.Event.Registration.' . $key] = $val;
157
-            }
158
-        }
159
-        return $question_where_params;
160
-    }
142
+	/**
143
+	 * Takes where params meant for registrations and changes them to work for questions
144
+	 *
145
+	 * @param array $reg_where_params
146
+	 * @return array
147
+	 */
148
+	protected function _change_registration_where_params_to_question_where_params($reg_where_params)
149
+	{
150
+		$question_where_params = array();
151
+		foreach ($reg_where_params as $key => $val) {
152
+			if (\EEM_Registration::instance()->is_logic_query_param_key($key)) {
153
+				$question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
154
+			} else {
155
+				//it's a normal where condition
156
+				$question_where_params['Question_Group.Event.Registration.' . $key] = $val;
157
+			}
158
+		}
159
+		return $question_where_params;
160
+	}
161 161
 
162 162
 
163 163
 
164
-    /**
165
-     * Performs another step of the job
166
-     *
167
-     * @param JobParameters $job_parameters
168
-     * @param int           $batch_size
169
-     * @return JobStepResponse
170
-     * @throws \EE_Error
171
-     */
172
-    public function continue_job(JobParameters $job_parameters, $batch_size = 50)
173
-    {
174
-        if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
175
-            $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
176
-                $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
177
-                $job_parameters->extra_datum('query_params'));
178
-            \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
179
-            $units_processed = count($csv_data);
180
-        }else{
181
-            $units_processed = 0;
182
-        }
183
-        $job_parameters->mark_processed($units_processed);
184
-        $extra_response_data = array(
185
-            'file_url' => '',
186
-        );
187
-        if ($units_processed < $batch_size) {
188
-            $job_parameters->set_status(JobParameters::status_complete);
189
-            $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
190
-        }
164
+	/**
165
+	 * Performs another step of the job
166
+	 *
167
+	 * @param JobParameters $job_parameters
168
+	 * @param int           $batch_size
169
+	 * @return JobStepResponse
170
+	 * @throws \EE_Error
171
+	 */
172
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50)
173
+	{
174
+		if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
175
+			$csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
176
+				$job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
177
+				$job_parameters->extra_datum('query_params'));
178
+			\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
179
+			$units_processed = count($csv_data);
180
+		}else{
181
+			$units_processed = 0;
182
+		}
183
+		$job_parameters->mark_processed($units_processed);
184
+		$extra_response_data = array(
185
+			'file_url' => '',
186
+		);
187
+		if ($units_processed < $batch_size) {
188
+			$job_parameters->set_status(JobParameters::status_complete);
189
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
190
+		}
191 191
 
192
-        return new JobStepResponse($job_parameters,
193
-            sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)),
194
-            $extra_response_data);
195
-    }
192
+		return new JobStepResponse($job_parameters,
193
+			sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)),
194
+			$extra_response_data);
195
+	}
196 196
 
197 197
 
198 198
 
199
-    /**
200
-     * Gets the csv data for a batch of registrations
201
-
202
-     *
199
+	/**
200
+	 * Gets the csv data for a batch of registrations
201
+	 *
203 202
 *@param int|null    $event_id
204
-     * @param int   $offset
205
-     * @param int   $limit
206
-     * @param array $question_labels the IDs for all the questions which were answered by someone in this selection
207
-     * @param array $query_params    for using where querying the model
208
-     * @return array top-level keys are numeric, next-level keys are column headers
209
-     */
210
-    function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params)
211
-    {
212
-        $reg_fields_to_include = array(
213
-            'TXN_ID',
214
-            'ATT_ID',
215
-            'REG_ID',
216
-            'REG_date',
217
-            'REG_code',
218
-            'REG_count',
219
-            'REG_final_price',
220
-        );
221
-        $att_fields_to_include = array(
222
-            'ATT_fname',
223
-            'ATT_lname',
224
-            'ATT_email',
225
-            'ATT_address',
226
-            'ATT_address2',
227
-            'ATT_city',
228
-            'STA_ID',
229
-            'CNT_ISO',
230
-            'ATT_zip',
231
-            'ATT_phone',
232
-        );
233
-        $registrations_csv_ready_array = array();
234
-        $reg_model = \EE_Registry::instance()->load_model('Registration');
235
-        $query_params['limit'] = array($offset, $limit);
236
-        $registration_rows = $reg_model->get_all_wpdb_results($query_params);
237
-        $registration_ids = array();
238
-        foreach ($registration_rows as $reg_row) {
239
-            $registration_ids[] = intval($reg_row['Registration.REG_ID']);
240
-        }
241
-        foreach ($registration_rows as $reg_row) {
242
-            if (is_array($reg_row)) {
243
-                $reg_csv_array = array();
244
-                if ( ! $event_id) {
245
-                    //get the event's name and Id
246
-                    $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'),
247
-                        \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name',
248
-                            $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
249
-                }
250
-                $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
251
-                /*@var $reg_row EE_Registration */
252
-                foreach ($reg_fields_to_include as $field_name) {
253
-                    $field = $reg_model->field_settings_for($field_name);
254
-                    if ($field_name == 'REG_final_price') {
255
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
256
-                            $reg_row['Registration.REG_final_price'], 'localized_float');
257
-                    } elseif ($field_name == 'REG_count') {
258
-                        $value = sprintf(__('%s of %s', 'event_espresso'),
259
-                            \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count',
260
-                                $reg_row['Registration.REG_count']),
261
-                            \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size',
262
-                                $reg_row['Registration.REG_group_size']));
263
-                    } elseif ($field_name == 'REG_date') {
264
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
265
-                            $reg_row['Registration.REG_date'], 'no_html');
266
-                    } else {
267
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
268
-                            $reg_row[$field->get_qualified_column()]);
269
-                    }
270
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
271
-                    if ($field_name == 'REG_final_price') {
272
-                        //add a column named Currency after the final price
273
-                        $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
274
-                    }
275
-                }
276
-                //get pretty status
277
-                $stati = \EEM_Status::instance()->localized_status(array(
278
-                    $reg_row['Registration.STS_ID']     => __('unknown', 'event_espresso'),
279
-                    $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'),
280
-                ), false, 'sentence');
281
-                $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
282
-                //get pretty transaction status
283
-                $reg_csv_array[__("Transaction Status",
284
-                    'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
285
-                $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg
286
-                    ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total',
287
-                        $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
288
-                $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg
289
-                    ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid',
290
-                        $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
291
-                $payment_methods = array();
292
-                $gateway_txn_ids_etc = array();
293
-                $payment_times = array();
294
-                if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
295
-                    $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
296
-                        array(
297
-                            'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
298
-                            'STS_ID' => \EEM_Payment::status_id_approved,
299
-                        ),
300
-                        'force_join' => array('Payment_Method'),
301
-                    ), ARRAY_A,
302
-                        'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
303
-                    foreach ($payments_info as $payment_method_and_gateway_txn_id) {
304
-                        $payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
305
-                            ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
306
-                        $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
307
-                            ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
308
-                        $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
309
-                            ? $payment_method_and_gateway_txn_id['payment_time'] : '';
310
-                    }
311
-                }
312
-                $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
313
-                $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
314
-                $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
315
-                //get whether or not the user has checked in
316
-                $reg_csv_array[__("Check-Ins",
317
-                    "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
318
-                //get ticket of registration and its price
319
-                $ticket_model = \EE_Registry::instance()->load_model('Ticket');
320
-                if ($reg_row['Ticket.TKT_ID']) {
321
-                    $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name',
322
-                        $reg_row['Ticket.TKT_name']);
323
-                    $datetimes_strings = array();
324
-                    foreach (
325
-                        \EEM_Datetime::instance()->get_all_wpdb_results(array(
326
-                            array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']),
327
-                            'order_by'                 => array('DTT_EVT_start' => 'ASC'),
328
-                            'default_where_conditions' => 'none',
329
-                        )) as $datetime
330
-                    ) {
331
-                        $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(),
332
-                            'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
333
-                    }
334
-                } else {
335
-                    $ticket_name = __('Unknown', 'event_espresso');
336
-                    $datetimes_strings = array(__('Unknown', 'event_espresso'));
337
-                }
338
-                $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
339
-                $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
340
-                //get datetime(s) of registration
341
-                //add attendee columns
342
-                foreach ($att_fields_to_include as $att_field_name) {
343
-                    $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
344
-                    if ($reg_row['Attendee_CPT.ID']) {
345
-                        if ($att_field_name == 'STA_ID') {
346
-                            $value = \EEM_State::instance()
347
-                                               ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])),
348
-                                                   'STA_name');
349
-                        } elseif ($att_field_name == 'CNT_ISO') {
350
-                            $value = \EEM_Country::instance()
351
-                                                 ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])),
352
-                                                     'CNT_name');
353
-                        } else {
354
-                            $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(),
355
-                                $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
356
-                        }
357
-                    } else {
358
-                        $value = '';
359
-                    }
360
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
361
-                }
362
-                //make sure each registration has the same questions in the same order
363
-                foreach ($question_labels as $question_label) {
364
-                    if ( ! isset($reg_csv_array[$question_label])) {
365
-                        $reg_csv_array[$question_label] = null;
366
-                    }
367
-                }
368
-                $answers = \EEM_Answer::instance()->get_all_wpdb_results(array(
369
-                    array('REG_ID' => $reg_row['Registration.REG_ID']),
370
-                    'force_join' => array('Question'),
371
-                ));
372
-                //now fill out the questions THEY answered
373
-                foreach ($answers as $answer_row) {
374
-                    if ($answer_row['Question.QST_ID']) {
375
-                        $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(),
376
-                            'QST_admin_label', $answer_row['Question.QST_admin_label']);
377
-                    } else {
378
-                        $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
379
-                    }
380
-                    if (isset($answer_row['Question.QST_type'])
381
-                        && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
382
-                    ) {
383
-                        $reg_csv_array[$question_label] = \EEM_State::instance()
384
-                                                                    ->get_state_name_by_ID($answer_row['Answer.ANS_value']);
385
-                    } else {
386
-                        //this isn't for html, so don't show html entities
387
-                        $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(),
388
-                            'ANS_value', $answer_row['Answer.ANS_value']));
389
-                    }
390
-                }
391
-                /**
392
-                 * Filter to change the contents of each row of the registrations report CSV file.
393
-                 *
394
-                 * This can be used to add or remote columns from the CSV file, or change their values.                 *
395
-                 * Note: it has this name because originally that's where this filter resided,
396
-                 * and we've left its name as-is for backward compatibility.
397
-                 * Note when using: all rows in the CSV should have the same columns.
398
-                 *
399
-                 * @param array $reg_csv_array keys are column-header names, and values are that columns' value
400
-                 *                             in this row
401
-                 * @param array $reg_row is the row from the database's wp_esp_registration table
402
-                 *
403
-                 */
404
-                $registrations_csv_ready_array[] = apply_filters(
405
-                    'FHEE__EE_Export__report_registrations__reg_csv_array',
406
-                    $reg_csv_array,
407
-                    $reg_row
408
-                );
409
-            }
410
-        }
411
-        //if we couldn't export anything, we want to at least show the column headers
412
-        if (empty($registrations_csv_ready_array)) {
413
-            $reg_csv_array = array();
414
-            $model_and_fields_to_include = array(
415
-                'Registration' => $reg_fields_to_include,
416
-                'Attendee'     => $att_fields_to_include,
417
-            );
418
-            foreach ($model_and_fields_to_include as $model_name => $field_list) {
419
-                $model = \EE_Registry::instance()->load_model($model_name);
420
-                foreach ($field_list as $field_name) {
421
-                    $field = $model->field_settings_for($field_name);
422
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
423
-                }
424
-            }
425
-            $registrations_csv_ready_array[] = $reg_csv_array;
426
-        }
427
-        return $registrations_csv_ready_array;
428
-    }
203
+	 * @param int   $offset
204
+	 * @param int   $limit
205
+	 * @param array $question_labels the IDs for all the questions which were answered by someone in this selection
206
+	 * @param array $query_params    for using where querying the model
207
+	 * @return array top-level keys are numeric, next-level keys are column headers
208
+	 */
209
+	function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params)
210
+	{
211
+		$reg_fields_to_include = array(
212
+			'TXN_ID',
213
+			'ATT_ID',
214
+			'REG_ID',
215
+			'REG_date',
216
+			'REG_code',
217
+			'REG_count',
218
+			'REG_final_price',
219
+		);
220
+		$att_fields_to_include = array(
221
+			'ATT_fname',
222
+			'ATT_lname',
223
+			'ATT_email',
224
+			'ATT_address',
225
+			'ATT_address2',
226
+			'ATT_city',
227
+			'STA_ID',
228
+			'CNT_ISO',
229
+			'ATT_zip',
230
+			'ATT_phone',
231
+		);
232
+		$registrations_csv_ready_array = array();
233
+		$reg_model = \EE_Registry::instance()->load_model('Registration');
234
+		$query_params['limit'] = array($offset, $limit);
235
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
236
+		$registration_ids = array();
237
+		foreach ($registration_rows as $reg_row) {
238
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
239
+		}
240
+		foreach ($registration_rows as $reg_row) {
241
+			if (is_array($reg_row)) {
242
+				$reg_csv_array = array();
243
+				if ( ! $event_id) {
244
+					//get the event's name and Id
245
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'),
246
+						\EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name',
247
+							$reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
248
+				}
249
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
250
+				/*@var $reg_row EE_Registration */
251
+				foreach ($reg_fields_to_include as $field_name) {
252
+					$field = $reg_model->field_settings_for($field_name);
253
+					if ($field_name == 'REG_final_price') {
254
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
255
+							$reg_row['Registration.REG_final_price'], 'localized_float');
256
+					} elseif ($field_name == 'REG_count') {
257
+						$value = sprintf(__('%s of %s', 'event_espresso'),
258
+							\EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count',
259
+								$reg_row['Registration.REG_count']),
260
+							\EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size',
261
+								$reg_row['Registration.REG_group_size']));
262
+					} elseif ($field_name == 'REG_date') {
263
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
264
+							$reg_row['Registration.REG_date'], 'no_html');
265
+					} else {
266
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
267
+							$reg_row[$field->get_qualified_column()]);
268
+					}
269
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
270
+					if ($field_name == 'REG_final_price') {
271
+						//add a column named Currency after the final price
272
+						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
273
+					}
274
+				}
275
+				//get pretty status
276
+				$stati = \EEM_Status::instance()->localized_status(array(
277
+					$reg_row['Registration.STS_ID']     => __('unknown', 'event_espresso'),
278
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'),
279
+				), false, 'sentence');
280
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
281
+				//get pretty transaction status
282
+				$reg_csv_array[__("Transaction Status",
283
+					'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
284
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg
285
+					? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total',
286
+						$reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
287
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg
288
+					? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid',
289
+						$reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
290
+				$payment_methods = array();
291
+				$gateway_txn_ids_etc = array();
292
+				$payment_times = array();
293
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
294
+					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
295
+						array(
296
+							'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
297
+							'STS_ID' => \EEM_Payment::status_id_approved,
298
+						),
299
+						'force_join' => array('Payment_Method'),
300
+					), ARRAY_A,
301
+						'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
302
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
303
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
304
+							? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
305
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
306
+							? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
307
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
308
+							? $payment_method_and_gateway_txn_id['payment_time'] : '';
309
+					}
310
+				}
311
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
312
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
313
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
314
+				//get whether or not the user has checked in
315
+				$reg_csv_array[__("Check-Ins",
316
+					"event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
317
+				//get ticket of registration and its price
318
+				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
319
+				if ($reg_row['Ticket.TKT_ID']) {
320
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name',
321
+						$reg_row['Ticket.TKT_name']);
322
+					$datetimes_strings = array();
323
+					foreach (
324
+						\EEM_Datetime::instance()->get_all_wpdb_results(array(
325
+							array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']),
326
+							'order_by'                 => array('DTT_EVT_start' => 'ASC'),
327
+							'default_where_conditions' => 'none',
328
+						)) as $datetime
329
+					) {
330
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(),
331
+							'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
332
+					}
333
+				} else {
334
+					$ticket_name = __('Unknown', 'event_espresso');
335
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
336
+				}
337
+				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
338
+				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
339
+				//get datetime(s) of registration
340
+				//add attendee columns
341
+				foreach ($att_fields_to_include as $att_field_name) {
342
+					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
343
+					if ($reg_row['Attendee_CPT.ID']) {
344
+						if ($att_field_name == 'STA_ID') {
345
+							$value = \EEM_State::instance()
346
+											   ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])),
347
+												   'STA_name');
348
+						} elseif ($att_field_name == 'CNT_ISO') {
349
+							$value = \EEM_Country::instance()
350
+												 ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])),
351
+													 'CNT_name');
352
+						} else {
353
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(),
354
+								$att_field_name, $reg_row[$field_obj->get_qualified_column()]);
355
+						}
356
+					} else {
357
+						$value = '';
358
+					}
359
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
360
+				}
361
+				//make sure each registration has the same questions in the same order
362
+				foreach ($question_labels as $question_label) {
363
+					if ( ! isset($reg_csv_array[$question_label])) {
364
+						$reg_csv_array[$question_label] = null;
365
+					}
366
+				}
367
+				$answers = \EEM_Answer::instance()->get_all_wpdb_results(array(
368
+					array('REG_ID' => $reg_row['Registration.REG_ID']),
369
+					'force_join' => array('Question'),
370
+				));
371
+				//now fill out the questions THEY answered
372
+				foreach ($answers as $answer_row) {
373
+					if ($answer_row['Question.QST_ID']) {
374
+						$question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(),
375
+							'QST_admin_label', $answer_row['Question.QST_admin_label']);
376
+					} else {
377
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
378
+					}
379
+					if (isset($answer_row['Question.QST_type'])
380
+						&& $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
381
+					) {
382
+						$reg_csv_array[$question_label] = \EEM_State::instance()
383
+																	->get_state_name_by_ID($answer_row['Answer.ANS_value']);
384
+					} else {
385
+						//this isn't for html, so don't show html entities
386
+						$reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(),
387
+							'ANS_value', $answer_row['Answer.ANS_value']));
388
+					}
389
+				}
390
+				/**
391
+				 * Filter to change the contents of each row of the registrations report CSV file.
392
+				 *
393
+				 * This can be used to add or remote columns from the CSV file, or change their values.                 *
394
+				 * Note: it has this name because originally that's where this filter resided,
395
+				 * and we've left its name as-is for backward compatibility.
396
+				 * Note when using: all rows in the CSV should have the same columns.
397
+				 *
398
+				 * @param array $reg_csv_array keys are column-header names, and values are that columns' value
399
+				 *                             in this row
400
+				 * @param array $reg_row is the row from the database's wp_esp_registration table
401
+				 *
402
+				 */
403
+				$registrations_csv_ready_array[] = apply_filters(
404
+					'FHEE__EE_Export__report_registrations__reg_csv_array',
405
+					$reg_csv_array,
406
+					$reg_row
407
+				);
408
+			}
409
+		}
410
+		//if we couldn't export anything, we want to at least show the column headers
411
+		if (empty($registrations_csv_ready_array)) {
412
+			$reg_csv_array = array();
413
+			$model_and_fields_to_include = array(
414
+				'Registration' => $reg_fields_to_include,
415
+				'Attendee'     => $att_fields_to_include,
416
+			);
417
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
418
+				$model = \EE_Registry::instance()->load_model($model_name);
419
+				foreach ($field_list as $field_name) {
420
+					$field = $model->field_settings_for($field_name);
421
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
422
+				}
423
+			}
424
+			$registrations_csv_ready_array[] = $reg_csv_array;
425
+		}
426
+		return $registrations_csv_ready_array;
427
+	}
429 428
 
430 429
 
431 430
 
432
-    /**
433
-     * Counts total unit to process
434
-     *
435
-     * @deprecated since 4.9.19
436
-     * @param int|array $event_id
437
-     * @return int
438
-     */
439
-    public function count_units_to_process($event_id)
440
-    {
441
-        //use the legacy filter
442
-        if ($event_id) {
443
-            $query_params[0]['EVT_ID'] = $event_id;
444
-        } else {
445
-            $query_params['force_join'][] = 'Event';
446
-        }
447
-        return \EEM_Registration::instance()->count($query_params);
448
-    }
431
+	/**
432
+	 * Counts total unit to process
433
+	 *
434
+	 * @deprecated since 4.9.19
435
+	 * @param int|array $event_id
436
+	 * @return int
437
+	 */
438
+	public function count_units_to_process($event_id)
439
+	{
440
+		//use the legacy filter
441
+		if ($event_id) {
442
+			$query_params[0]['EVT_ID'] = $event_id;
443
+		} else {
444
+			$query_params['force_join'][] = 'Event';
445
+		}
446
+		return \EEM_Registration::instance()->count($query_params);
447
+	}
449 448
 
450 449
 
451 450
 
452
-    /**
453
-     * Performs any clean-up logic when we know the job is completed.
454
-     * In this case, we delete the temporary file
455
-     *
456
-     * @param JobParameters $job_parameters
457
-     * @return boolean
458
-     */
459
-    public function cleanup_job(JobParameters $job_parameters)
460
-    {
461
-        $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
462
-            true, 'd');
463
-        return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
464
-    }
451
+	/**
452
+	 * Performs any clean-up logic when we know the job is completed.
453
+	 * In this case, we delete the temporary file
454
+	 *
455
+	 * @param JobParameters $job_parameters
456
+	 * @return boolean
457
+	 */
458
+	public function cleanup_job(JobParameters $job_parameters)
459
+	{
460
+		$this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
461
+			true, 'd');
462
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
463
+	}
465 464
 }
466 465
 
467 466
 
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@
 block discarded – undo
227 227
      *    _get_table_filters
228 228
      *
229 229
      * @access protected
230
-     * @return array
230
+     * @return string[]
231 231
      */
232 232
     protected function _get_table_filters()
233 233
     {
Please login to merge, or discard this patch.
Indentation   +926 added lines, -926 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\exceptions\InvalidInterfaceException;
4 4
 
5 5
 if (! defined('EVENT_ESPRESSO_VERSION')) {
6
-    exit('No direct script access allowed');
6
+	exit('No direct script access allowed');
7 7
 }
8 8
 
9 9
 
@@ -28,1006 +28,1006 @@  discard block
 block discarded – undo
28 28
 {
29 29
 
30 30
 
31
-    /**
32
-     * @var array
33
-     */
34
-    private $_status;
31
+	/**
32
+	 * @var array
33
+	 */
34
+	private $_status;
35 35
 
36 36
 
37
-    /**
38
-     * An array of transaction details for the related transaction to the registration being processed.
39
-     * This is set via the _set_related_details method.
40
-     *
41
-     * @var array
42
-     */
43
-    protected $_transaction_details = array();
37
+	/**
38
+	 * An array of transaction details for the related transaction to the registration being processed.
39
+	 * This is set via the _set_related_details method.
40
+	 *
41
+	 * @var array
42
+	 */
43
+	protected $_transaction_details = array();
44 44
 
45 45
 
46
-    /**
47
-     * An array of event details for the related event to the registration being processed.
48
-     * This is set via the _set_related_details method.
49
-     *
50
-     * @var array
51
-     */
52
-    protected $_event_details = array();
46
+	/**
47
+	 * An array of event details for the related event to the registration being processed.
48
+	 * This is set via the _set_related_details method.
49
+	 *
50
+	 * @var array
51
+	 */
52
+	protected $_event_details = array();
53 53
 
54 54
 
55
-    /**
56
-     * @param \Registrations_Admin_Page $admin_page
57
-     */
58
-    public function __construct(Registrations_Admin_Page $admin_page)
59
-    {
60
-        if (! empty($_GET['event_id'])) {
61
-            $extra_query_args = array();
62
-            foreach ($admin_page->get_views() as $key => $view_details) {
63
-                $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
64
-            }
65
-            $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
66
-        }
67
-        parent::__construct($admin_page);
68
-        $this->_status = $this->_admin_page->get_registration_status_array();
69
-    }
55
+	/**
56
+	 * @param \Registrations_Admin_Page $admin_page
57
+	 */
58
+	public function __construct(Registrations_Admin_Page $admin_page)
59
+	{
60
+		if (! empty($_GET['event_id'])) {
61
+			$extra_query_args = array();
62
+			foreach ($admin_page->get_views() as $key => $view_details) {
63
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
64
+			}
65
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
66
+		}
67
+		parent::__construct($admin_page);
68
+		$this->_status = $this->_admin_page->get_registration_status_array();
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     *    _setup_data
74
-     *
75
-     * @access protected
76
-     * @return void
77
-     */
78
-    protected function _setup_data()
79
-    {
80
-        $this->_data = $this->_admin_page->get_registrations($this->_per_page);
81
-        $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false);
82
-    }
72
+	/**
73
+	 *    _setup_data
74
+	 *
75
+	 * @access protected
76
+	 * @return void
77
+	 */
78
+	protected function _setup_data()
79
+	{
80
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
81
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false);
82
+	}
83 83
 
84 84
 
85
-    /**
86
-     *    _set_properties
87
-     *
88
-     * @access protected
89
-     * @return void
90
-     */
91
-    protected function _set_properties()
92
-    {
93
-        $this->_wp_list_args = array(
94
-            'singular' => __('registration', 'event_espresso'),
95
-            'plural'   => __('registrations', 'event_espresso'),
96
-            'ajax'     => true,
97
-            'screen'   => $this->_admin_page->get_current_screen()->id,
98
-        );
99
-        $ID_column_name = __('ID', 'event_espresso');
100
-        $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
101
-        $ID_column_name .= __('Registrant Name', 'event_espresso');
102
-        $ID_column_name .= '</span> ';
103
-        if (isset($_GET['event_id'])) {
104
-            $this->_columns = array(
105
-                'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
106
-                '_REG_ID'          => $ID_column_name,
107
-                'ATT_fname'        => __('Name', 'event_espresso'),
108
-                'ATT_email'        => __('Email', 'event_espresso'),
109
-                '_REG_date'        => __('Reg Date', 'event_espresso'),
110
-                'PRC_amount'       => __('TKT Price', 'event_espresso'),
111
-                '_REG_final_price' => __('Final Price', 'event_espresso'),
112
-                'TXN_total'        => __('Total Txn', 'event_espresso'),
113
-                'TXN_paid'         => __('Paid', 'event_espresso'),
114
-                'actions'          => __('Actions', 'event_espresso'),
115
-            );
116
-            $this->_bottom_buttons = array(
117
-                'report' => array(
118
-                    'route'         => 'registrations_report',
119
-                    'extra_request' => array(
120
-                        'EVT_ID'     => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
121
-                        'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
122
-                    ),
123
-                ),
124
-            );
125
-        } else {
126
-            $this->_columns = array(
127
-                'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
128
-                '_REG_ID'          => $ID_column_name,
129
-                'ATT_fname'        => __('Name', 'event_espresso'),
130
-                '_REG_date'        => __('TXN Date', 'event_espresso'),
131
-                'event_name'       => __('Event', 'event_espresso'),
132
-                'DTT_EVT_start'    => __('Event Date', 'event_espresso'),
133
-                '_REG_final_price' => __('Price', 'event_espresso'),
134
-                '_REG_paid'        => __('Paid', 'event_espresso'),
135
-                'actions'          => __('Actions', 'event_espresso'),
136
-            );
137
-            $this->_bottom_buttons = array(
138
-                'report_all' => array(
139
-                    'route'         => 'registrations_report',
140
-                    'extra_request' => array(
141
-                        'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
142
-                    ),
143
-                ),
144
-            );
145
-        }
146
-        $this->_bottom_buttons['report_filtered'] = array(
147
-            'route'         => 'registrations_report',
148
-            'extra_request' => array(
149
-                'use_filters' => true,
150
-                'filters'     => array_diff_key($this->_req_data, array_flip(array(
151
-                    'page',
152
-                    'action',
153
-                    'default_nonce',
154
-                ))),
155
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
156
-            ),
157
-        );
158
-        $this->_primary_column = '_REG_ID';
159
-        $this->_sortable_columns = array(
160
-            '_REG_date'     => array('_REG_date' => true),   //true means its already sorted
161
-            /**
162
-             * Allows users to change the default sort if they wish.
163
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
164
-             * name.
165
-             */
166
-            'ATT_fname'     => array(
167
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
168
-                true,
169
-                $this,
170
-            )
171
-                ? array('ATT_lname' => false)
172
-                : array('ATT_fname' => false),
173
-            'event_name'    => array('event_name' => false),
174
-            'DTT_EVT_start' => array('DTT_EVT_start' => false),
175
-            '_REG_ID'       => array('_REG_ID' => false),
176
-        );
177
-        $this->_hidden_columns = array();
178
-    }
85
+	/**
86
+	 *    _set_properties
87
+	 *
88
+	 * @access protected
89
+	 * @return void
90
+	 */
91
+	protected function _set_properties()
92
+	{
93
+		$this->_wp_list_args = array(
94
+			'singular' => __('registration', 'event_espresso'),
95
+			'plural'   => __('registrations', 'event_espresso'),
96
+			'ajax'     => true,
97
+			'screen'   => $this->_admin_page->get_current_screen()->id,
98
+		);
99
+		$ID_column_name = __('ID', 'event_espresso');
100
+		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
101
+		$ID_column_name .= __('Registrant Name', 'event_espresso');
102
+		$ID_column_name .= '</span> ';
103
+		if (isset($_GET['event_id'])) {
104
+			$this->_columns = array(
105
+				'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
106
+				'_REG_ID'          => $ID_column_name,
107
+				'ATT_fname'        => __('Name', 'event_espresso'),
108
+				'ATT_email'        => __('Email', 'event_espresso'),
109
+				'_REG_date'        => __('Reg Date', 'event_espresso'),
110
+				'PRC_amount'       => __('TKT Price', 'event_espresso'),
111
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
112
+				'TXN_total'        => __('Total Txn', 'event_espresso'),
113
+				'TXN_paid'         => __('Paid', 'event_espresso'),
114
+				'actions'          => __('Actions', 'event_espresso'),
115
+			);
116
+			$this->_bottom_buttons = array(
117
+				'report' => array(
118
+					'route'         => 'registrations_report',
119
+					'extra_request' => array(
120
+						'EVT_ID'     => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
121
+						'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
122
+					),
123
+				),
124
+			);
125
+		} else {
126
+			$this->_columns = array(
127
+				'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
128
+				'_REG_ID'          => $ID_column_name,
129
+				'ATT_fname'        => __('Name', 'event_espresso'),
130
+				'_REG_date'        => __('TXN Date', 'event_espresso'),
131
+				'event_name'       => __('Event', 'event_espresso'),
132
+				'DTT_EVT_start'    => __('Event Date', 'event_espresso'),
133
+				'_REG_final_price' => __('Price', 'event_espresso'),
134
+				'_REG_paid'        => __('Paid', 'event_espresso'),
135
+				'actions'          => __('Actions', 'event_espresso'),
136
+			);
137
+			$this->_bottom_buttons = array(
138
+				'report_all' => array(
139
+					'route'         => 'registrations_report',
140
+					'extra_request' => array(
141
+						'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
142
+					),
143
+				),
144
+			);
145
+		}
146
+		$this->_bottom_buttons['report_filtered'] = array(
147
+			'route'         => 'registrations_report',
148
+			'extra_request' => array(
149
+				'use_filters' => true,
150
+				'filters'     => array_diff_key($this->_req_data, array_flip(array(
151
+					'page',
152
+					'action',
153
+					'default_nonce',
154
+				))),
155
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
156
+			),
157
+		);
158
+		$this->_primary_column = '_REG_ID';
159
+		$this->_sortable_columns = array(
160
+			'_REG_date'     => array('_REG_date' => true),   //true means its already sorted
161
+			/**
162
+			 * Allows users to change the default sort if they wish.
163
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
164
+			 * name.
165
+			 */
166
+			'ATT_fname'     => array(
167
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
168
+				true,
169
+				$this,
170
+			)
171
+				? array('ATT_lname' => false)
172
+				: array('ATT_fname' => false),
173
+			'event_name'    => array('event_name' => false),
174
+			'DTT_EVT_start' => array('DTT_EVT_start' => false),
175
+			'_REG_ID'       => array('_REG_ID' => false),
176
+		);
177
+		$this->_hidden_columns = array();
178
+	}
179 179
 
180 180
 
181
-    /**
182
-     * This simply sets up the row class for the table rows.
183
-     * Allows for easier overriding of child methods for setting up sorting.
184
-     *
185
-     * @param  EE_Registration $item the current item
186
-     * @return string
187
-     */
188
-    protected function _get_row_class($item)
189
-    {
190
-        $class = parent::_get_row_class($item);
191
-        //add status class
192
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
193
-        if ($this->_has_checkbox_column) {
194
-            $class .= ' has-checkbox-column';
195
-        }
196
-        return $class;
197
-    }
181
+	/**
182
+	 * This simply sets up the row class for the table rows.
183
+	 * Allows for easier overriding of child methods for setting up sorting.
184
+	 *
185
+	 * @param  EE_Registration $item the current item
186
+	 * @return string
187
+	 */
188
+	protected function _get_row_class($item)
189
+	{
190
+		$class = parent::_get_row_class($item);
191
+		//add status class
192
+		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
193
+		if ($this->_has_checkbox_column) {
194
+			$class .= ' has-checkbox-column';
195
+		}
196
+		return $class;
197
+	}
198 198
 
199 199
 
200
-    /**
201
-     * Set the $_transaction_details property if not set yet.
202
-     *
203
-     * @param EE_Registration $registration
204
-     * @throws EE_Error
205
-     * @throws InvalidArgumentException
206
-     * @throws ReflectionException
207
-     * @throws InvalidDataTypeException
208
-     * @throws InvalidInterfaceException
209
-     */
210
-    protected function _set_related_details(EE_Registration $registration)
211
-    {
212
-        $transaction = $registration->get_first_related('Transaction');
213
-        $status = $transaction instanceof EE_Transaction ? $transaction->status_ID()
214
-            : EEM_Transaction::failed_status_code;
215
-        $this->_transaction_details = array(
216
-            'transaction' => $transaction,
217
-            'status'      => $status,
218
-            'id'          => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
219
-            'title_attr'  => sprintf(
220
-                __('View Transaction Details (%s)', 'event_espresso'),
221
-                EEH_Template::pretty_status($status, false, 'sentence')
222
-            ),
223
-        );
224
-        try {
225
-            $event = $registration->event();
226
-        } catch (EntityNotFoundException $e) {
227
-            $event = null;
228
-        }
229
-        $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
230
-        $this->_event_details = array(
231
-            'event'      => $event,
232
-            'status'     => $status,
233
-            'id'         => $event instanceof EE_Event ? $event->ID() : 0,
234
-            'title_attr' => sprintf(
235
-                __('Edit Event (%s)', 'event_espresso'),
236
-                EEH_Template::pretty_status($status, false, 'sentence')
237
-            ),
238
-        );
239
-    }
200
+	/**
201
+	 * Set the $_transaction_details property if not set yet.
202
+	 *
203
+	 * @param EE_Registration $registration
204
+	 * @throws EE_Error
205
+	 * @throws InvalidArgumentException
206
+	 * @throws ReflectionException
207
+	 * @throws InvalidDataTypeException
208
+	 * @throws InvalidInterfaceException
209
+	 */
210
+	protected function _set_related_details(EE_Registration $registration)
211
+	{
212
+		$transaction = $registration->get_first_related('Transaction');
213
+		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID()
214
+			: EEM_Transaction::failed_status_code;
215
+		$this->_transaction_details = array(
216
+			'transaction' => $transaction,
217
+			'status'      => $status,
218
+			'id'          => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
219
+			'title_attr'  => sprintf(
220
+				__('View Transaction Details (%s)', 'event_espresso'),
221
+				EEH_Template::pretty_status($status, false, 'sentence')
222
+			),
223
+		);
224
+		try {
225
+			$event = $registration->event();
226
+		} catch (EntityNotFoundException $e) {
227
+			$event = null;
228
+		}
229
+		$status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
230
+		$this->_event_details = array(
231
+			'event'      => $event,
232
+			'status'     => $status,
233
+			'id'         => $event instanceof EE_Event ? $event->ID() : 0,
234
+			'title_attr' => sprintf(
235
+				__('Edit Event (%s)', 'event_espresso'),
236
+				EEH_Template::pretty_status($status, false, 'sentence')
237
+			),
238
+		);
239
+	}
240 240
 
241 241
 
242
-    /**
243
-     *    _get_table_filters
244
-     *
245
-     * @access protected
246
-     * @return array
247
-     */
248
-    protected function _get_table_filters()
249
-    {
250
-        $filters = array();
251
-        //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as
252
-        // methods.
253
-        $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
254
-        $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
255
-        $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
256
-        $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
257
-        $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
258
-        $status = array();
259
-        $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
260
-        foreach ($this->_status as $key => $value) {
261
-            $status[] = array('id' => $key, 'text' => $value);
262
-        }
263
-        if ($this->_view !== 'incomplete') {
264
-            $filters[] = EEH_Form_Fields::select_input(
265
-                '_reg_status',
266
-                $status,
267
-                isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
268
-                    : ''
269
-            );
270
-        }
271
-        if (isset($this->_req_data['event_id'])) {
272
-            $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
273
-        }
274
-        return $filters;
275
-    }
242
+	/**
243
+	 *    _get_table_filters
244
+	 *
245
+	 * @access protected
246
+	 * @return array
247
+	 */
248
+	protected function _get_table_filters()
249
+	{
250
+		$filters = array();
251
+		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as
252
+		// methods.
253
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
254
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
255
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
256
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
257
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
258
+		$status = array();
259
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
260
+		foreach ($this->_status as $key => $value) {
261
+			$status[] = array('id' => $key, 'text' => $value);
262
+		}
263
+		if ($this->_view !== 'incomplete') {
264
+			$filters[] = EEH_Form_Fields::select_input(
265
+				'_reg_status',
266
+				$status,
267
+				isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
268
+					: ''
269
+			);
270
+		}
271
+		if (isset($this->_req_data['event_id'])) {
272
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
273
+		}
274
+		return $filters;
275
+	}
276 276
 
277 277
 
278
-    /**
279
-     *    _add_view_counts
280
-     *
281
-     * @access protected
282
-     * @return void
283
-     * @throws EE_Error
284
-     * @throws InvalidArgumentException
285
-     * @throws InvalidDataTypeException
286
-     * @throws InvalidInterfaceException
287
-     */
288
-    protected function _add_view_counts()
289
-    {
290
-        $this->_views['all']['count'] = $this->_total_registrations();
291
-        $this->_views['month']['count'] = $this->_total_registrations_this_month();
292
-        $this->_views['today']['count'] = $this->_total_registrations_today();
293
-        if (EE_Registry::instance()->CAP->current_user_can(
294
-            'ee_delete_registrations',
295
-            'espresso_registrations_trash_registrations'
296
-        )) {
297
-            $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
298
-            $this->_views['trash']['count'] = $this->_total_registrations('trash');
299
-        }
300
-    }
278
+	/**
279
+	 *    _add_view_counts
280
+	 *
281
+	 * @access protected
282
+	 * @return void
283
+	 * @throws EE_Error
284
+	 * @throws InvalidArgumentException
285
+	 * @throws InvalidDataTypeException
286
+	 * @throws InvalidInterfaceException
287
+	 */
288
+	protected function _add_view_counts()
289
+	{
290
+		$this->_views['all']['count'] = $this->_total_registrations();
291
+		$this->_views['month']['count'] = $this->_total_registrations_this_month();
292
+		$this->_views['today']['count'] = $this->_total_registrations_today();
293
+		if (EE_Registry::instance()->CAP->current_user_can(
294
+			'ee_delete_registrations',
295
+			'espresso_registrations_trash_registrations'
296
+		)) {
297
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
298
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
299
+		}
300
+	}
301 301
 
302 302
 
303
-    /**
304
-     * _total_registrations
305
-     *
306
-     * @access protected
307
-     * @param string $view
308
-     * @return int
309
-     * @throws EE_Error
310
-     * @throws InvalidArgumentException
311
-     * @throws InvalidDataTypeException
312
-     * @throws InvalidInterfaceException
313
-     */
314
-    protected function _total_registrations($view = '')
315
-    {
316
-        $_where = array();
317
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
318
-        if ($EVT_ID) {
319
-            $_where['EVT_ID'] = $EVT_ID;
320
-        }
321
-        switch ($view) {
322
-            case 'trash':
323
-                return EEM_Registration::instance()->count_deleted(array($_where));
324
-                break;
325
-            case 'incomplete':
326
-                $_where['STS_ID'] = EEM_Registration::status_id_incomplete;
327
-                break;
328
-            default:
329
-                $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
330
-        }
331
-        return EEM_Registration::instance()->count(array($_where));
332
-    }
303
+	/**
304
+	 * _total_registrations
305
+	 *
306
+	 * @access protected
307
+	 * @param string $view
308
+	 * @return int
309
+	 * @throws EE_Error
310
+	 * @throws InvalidArgumentException
311
+	 * @throws InvalidDataTypeException
312
+	 * @throws InvalidInterfaceException
313
+	 */
314
+	protected function _total_registrations($view = '')
315
+	{
316
+		$_where = array();
317
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
318
+		if ($EVT_ID) {
319
+			$_where['EVT_ID'] = $EVT_ID;
320
+		}
321
+		switch ($view) {
322
+			case 'trash':
323
+				return EEM_Registration::instance()->count_deleted(array($_where));
324
+				break;
325
+			case 'incomplete':
326
+				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
327
+				break;
328
+			default:
329
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
330
+		}
331
+		return EEM_Registration::instance()->count(array($_where));
332
+	}
333 333
 
334 334
 
335
-    /**
336
-     * _total_registrations_this_month
337
-     *
338
-     * @access protected
339
-     * @return int
340
-     * @throws EE_Error
341
-     * @throws InvalidArgumentException
342
-     * @throws InvalidDataTypeException
343
-     * @throws InvalidInterfaceException
344
-     */
345
-    protected function _total_registrations_this_month()
346
-    {
347
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
348
-        $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
349
-        $this_year_r = date('Y', current_time('timestamp'));
350
-        $time_start = ' 00:00:00';
351
-        $time_end = ' 23:59:59';
352
-        $this_month_r = date('m', current_time('timestamp'));
353
-        $days_this_month = date('t', current_time('timestamp'));
354
-        //setup date query.
355
-        $beginning_string = EEM_Registration::instance()->convert_datetime_for_query(
356
-            'REG_date',
357
-            $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
358
-            'Y-m-d H:i:s'
359
-        );
360
-        $end_string = EEM_Registration::instance()->convert_datetime_for_query(
361
-            'REG_date',
362
-            $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
363
-            'Y-m-d H:i:s'
364
-        );
365
-        $_where['REG_date'] = array(
366
-            'BETWEEN',
367
-            array(
368
-                $beginning_string,
369
-                $end_string,
370
-            ),
371
-        );
372
-        $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
373
-        return EEM_Registration::instance()->count(array($_where));
374
-    }
335
+	/**
336
+	 * _total_registrations_this_month
337
+	 *
338
+	 * @access protected
339
+	 * @return int
340
+	 * @throws EE_Error
341
+	 * @throws InvalidArgumentException
342
+	 * @throws InvalidDataTypeException
343
+	 * @throws InvalidInterfaceException
344
+	 */
345
+	protected function _total_registrations_this_month()
346
+	{
347
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
348
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
349
+		$this_year_r = date('Y', current_time('timestamp'));
350
+		$time_start = ' 00:00:00';
351
+		$time_end = ' 23:59:59';
352
+		$this_month_r = date('m', current_time('timestamp'));
353
+		$days_this_month = date('t', current_time('timestamp'));
354
+		//setup date query.
355
+		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query(
356
+			'REG_date',
357
+			$this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
358
+			'Y-m-d H:i:s'
359
+		);
360
+		$end_string = EEM_Registration::instance()->convert_datetime_for_query(
361
+			'REG_date',
362
+			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
363
+			'Y-m-d H:i:s'
364
+		);
365
+		$_where['REG_date'] = array(
366
+			'BETWEEN',
367
+			array(
368
+				$beginning_string,
369
+				$end_string,
370
+			),
371
+		);
372
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
373
+		return EEM_Registration::instance()->count(array($_where));
374
+	}
375 375
 
376 376
 
377
-    /**
378
-     * _total_registrations_today
379
-     *
380
-     * @access protected
381
-     * @return int
382
-     * @throws EE_Error
383
-     * @throws InvalidArgumentException
384
-     * @throws InvalidDataTypeException
385
-     * @throws InvalidInterfaceException
386
-     */
387
-    protected function _total_registrations_today()
388
-    {
389
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
390
-        $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
391
-        $current_date = date('Y-m-d', current_time('timestamp'));
392
-        $time_start = ' 00:00:00';
393
-        $time_end = ' 23:59:59';
394
-        $_where['REG_date'] = array(
395
-            'BETWEEN',
396
-            array(
397
-                EEM_Registration::instance()->convert_datetime_for_query(
398
-                    'REG_date',
399
-                    $current_date . $time_start,
400
-                    'Y-m-d H:i:s'
401
-                ),
402
-                EEM_Registration::instance()->convert_datetime_for_query(
403
-                    'REG_date',
404
-                    $current_date . $time_end,
405
-                    'Y-m-d H:i:s'
406
-                ),
407
-            ),
408
-        );
409
-        $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
410
-        return EEM_Registration::instance()->count(array($_where));
411
-    }
377
+	/**
378
+	 * _total_registrations_today
379
+	 *
380
+	 * @access protected
381
+	 * @return int
382
+	 * @throws EE_Error
383
+	 * @throws InvalidArgumentException
384
+	 * @throws InvalidDataTypeException
385
+	 * @throws InvalidInterfaceException
386
+	 */
387
+	protected function _total_registrations_today()
388
+	{
389
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
390
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
391
+		$current_date = date('Y-m-d', current_time('timestamp'));
392
+		$time_start = ' 00:00:00';
393
+		$time_end = ' 23:59:59';
394
+		$_where['REG_date'] = array(
395
+			'BETWEEN',
396
+			array(
397
+				EEM_Registration::instance()->convert_datetime_for_query(
398
+					'REG_date',
399
+					$current_date . $time_start,
400
+					'Y-m-d H:i:s'
401
+				),
402
+				EEM_Registration::instance()->convert_datetime_for_query(
403
+					'REG_date',
404
+					$current_date . $time_end,
405
+					'Y-m-d H:i:s'
406
+				),
407
+			),
408
+		);
409
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
410
+		return EEM_Registration::instance()->count(array($_where));
411
+	}
412 412
 
413 413
 
414
-    /**
415
-     * column_cb
416
-     *
417
-     * @access public
418
-     * @param \EE_Registration $item
419
-     * @return string
420
-     * @throws EE_Error
421
-     * @throws InvalidArgumentException
422
-     * @throws InvalidDataTypeException
423
-     * @throws InvalidInterfaceException
424
-     * @throws ReflectionException
425
-     */
426
-    public function column_cb($item)
427
-    {
428
-        /** checkbox/lock **/
429
-        $transaction = $item->get_first_related('Transaction');
430
-        $payment_count = $transaction instanceof EE_Transaction
431
-            ? $transaction->count_related('Payment')
432
-            : 0;
433
-        return $payment_count > 0
434
-               || ! EE_Registry::instance()->CAP->current_user_can(
435
-                   'ee_edit_registration',
436
-                   'registration_list_table_checkbox_input',
437
-                   $item->ID()
438
-               )
439
-            ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID())
440
-              . '<span class="ee-lock-icon"></span>'
441
-            : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID());
442
-    }
414
+	/**
415
+	 * column_cb
416
+	 *
417
+	 * @access public
418
+	 * @param \EE_Registration $item
419
+	 * @return string
420
+	 * @throws EE_Error
421
+	 * @throws InvalidArgumentException
422
+	 * @throws InvalidDataTypeException
423
+	 * @throws InvalidInterfaceException
424
+	 * @throws ReflectionException
425
+	 */
426
+	public function column_cb($item)
427
+	{
428
+		/** checkbox/lock **/
429
+		$transaction = $item->get_first_related('Transaction');
430
+		$payment_count = $transaction instanceof EE_Transaction
431
+			? $transaction->count_related('Payment')
432
+			: 0;
433
+		return $payment_count > 0
434
+			   || ! EE_Registry::instance()->CAP->current_user_can(
435
+				   'ee_edit_registration',
436
+				   'registration_list_table_checkbox_input',
437
+				   $item->ID()
438
+			   )
439
+			? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID())
440
+			  . '<span class="ee-lock-icon"></span>'
441
+			: sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID());
442
+	}
443 443
 
444 444
 
445
-    /**
446
-     * column__REG_ID
447
-     *
448
-     * @access public
449
-     * @param \EE_Registration $item
450
-     * @return string
451
-     * @throws EE_Error
452
-     * @throws InvalidArgumentException
453
-     * @throws InvalidDataTypeException
454
-     * @throws InvalidInterfaceException
455
-     * @throws ReflectionException
456
-     */
457
-    public function column__REG_ID(EE_Registration $item)
458
-    {
459
-        $attendee = $item->attendee();
460
-        $content = $item->ID();
461
-        $content .= '<div class="show-on-mobile-view-only">';
462
-        $content .= '<br>';
463
-        $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
464
-        $content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
465
-        $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
466
-        $content .= '</div>';
467
-        return $content;
468
-    }
445
+	/**
446
+	 * column__REG_ID
447
+	 *
448
+	 * @access public
449
+	 * @param \EE_Registration $item
450
+	 * @return string
451
+	 * @throws EE_Error
452
+	 * @throws InvalidArgumentException
453
+	 * @throws InvalidDataTypeException
454
+	 * @throws InvalidInterfaceException
455
+	 * @throws ReflectionException
456
+	 */
457
+	public function column__REG_ID(EE_Registration $item)
458
+	{
459
+		$attendee = $item->attendee();
460
+		$content = $item->ID();
461
+		$content .= '<div class="show-on-mobile-view-only">';
462
+		$content .= '<br>';
463
+		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
464
+		$content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
465
+		$content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
466
+		$content .= '</div>';
467
+		return $content;
468
+	}
469 469
 
470 470
 
471
-    /**
472
-     * column__REG_date
473
-     *
474
-     * @access public
475
-     * @param \EE_Registration $item
476
-     * @return string
477
-     * @throws EE_Error
478
-     * @throws InvalidArgumentException
479
-     * @throws InvalidDataTypeException
480
-     * @throws InvalidInterfaceException
481
-     * @throws ReflectionException
482
-     */
483
-    public function column__REG_date(EE_Registration $item)
484
-    {
485
-        $this->_set_related_details($item);
486
-        //Build row actions
487
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
488
-            'action' => 'view_transaction',
489
-            'TXN_ID' => $this->_transaction_details['id'],
490
-        ), TXN_ADMIN_URL);
491
-        $view_link = EE_Registry::instance()->CAP->current_user_can(
492
-            'ee_read_transaction',
493
-            'espresso_transactions_view_transaction'
494
-        )
495
-            ? '<a class="ee-status-color-'
496
-                . $this->_transaction_details['status']
497
-                . '" href="'
498
-                . $view_lnk_url
499
-                . '" title="'
500
-                . esc_attr($this->_transaction_details['title_attr'])
501
-                . '">'
502
-                . $item->get_i18n_datetime('REG_date')
503
-                . '</a>' : $item->get_i18n_datetime('REG_date');
504
-        $view_link .= '<br><span class="ee-status-text-small">'
505
-                      . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence')
506
-                      . '</span>';
507
-        return $view_link;
508
-    }
471
+	/**
472
+	 * column__REG_date
473
+	 *
474
+	 * @access public
475
+	 * @param \EE_Registration $item
476
+	 * @return string
477
+	 * @throws EE_Error
478
+	 * @throws InvalidArgumentException
479
+	 * @throws InvalidDataTypeException
480
+	 * @throws InvalidInterfaceException
481
+	 * @throws ReflectionException
482
+	 */
483
+	public function column__REG_date(EE_Registration $item)
484
+	{
485
+		$this->_set_related_details($item);
486
+		//Build row actions
487
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
488
+			'action' => 'view_transaction',
489
+			'TXN_ID' => $this->_transaction_details['id'],
490
+		), TXN_ADMIN_URL);
491
+		$view_link = EE_Registry::instance()->CAP->current_user_can(
492
+			'ee_read_transaction',
493
+			'espresso_transactions_view_transaction'
494
+		)
495
+			? '<a class="ee-status-color-'
496
+				. $this->_transaction_details['status']
497
+				. '" href="'
498
+				. $view_lnk_url
499
+				. '" title="'
500
+				. esc_attr($this->_transaction_details['title_attr'])
501
+				. '">'
502
+				. $item->get_i18n_datetime('REG_date')
503
+				. '</a>' : $item->get_i18n_datetime('REG_date');
504
+		$view_link .= '<br><span class="ee-status-text-small">'
505
+					  . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence')
506
+					  . '</span>';
507
+		return $view_link;
508
+	}
509 509
 
510 510
 
511
-    /**
512
-     * column_event_name
513
-     *
514
-     * @access public
515
-     * @param \EE_Registration $item
516
-     * @return string
517
-     * @throws EE_Error
518
-     * @throws InvalidArgumentException
519
-     * @throws InvalidDataTypeException
520
-     * @throws InvalidInterfaceException
521
-     * @throws ReflectionException
522
-     */
523
-    public function column_event_name(EE_Registration $item)
524
-    {
525
-        $this->_set_related_details($item);
526
-        // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
527
-        $EVT_ID = $item->event_ID();
528
-        $event_name = $item->event_name();
529
-        $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
530
-        $event_name = wp_trim_words($event_name, 30, '...');
531
-        if ($EVT_ID) {
532
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
533
-                array('action' => 'edit', 'post' => $EVT_ID),
534
-                EVENTS_ADMIN_URL
535
-            );
536
-            $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
537
-                ? '<a class="ee-status-color-'
538
-                  . $this->_event_details['status']
539
-                  . '" href="'
540
-                  . $edit_event_url
541
-                  . '" title="'
542
-                  . esc_attr($this->_event_details['title_attr'])
543
-                  . '">'
544
-                  . $event_name
545
-                  . '</a>' : $event_name;
546
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
547
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
548
-            $actions['event_filter'] .= sprintf(
549
-                esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
550
-                $event_name
551
-            );
552
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
553
-        } else {
554
-            $edit_event = $event_name;
555
-            $actions['event_filter'] = '';
556
-        }
557
-        return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
558
-    }
511
+	/**
512
+	 * column_event_name
513
+	 *
514
+	 * @access public
515
+	 * @param \EE_Registration $item
516
+	 * @return string
517
+	 * @throws EE_Error
518
+	 * @throws InvalidArgumentException
519
+	 * @throws InvalidDataTypeException
520
+	 * @throws InvalidInterfaceException
521
+	 * @throws ReflectionException
522
+	 */
523
+	public function column_event_name(EE_Registration $item)
524
+	{
525
+		$this->_set_related_details($item);
526
+		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
527
+		$EVT_ID = $item->event_ID();
528
+		$event_name = $item->event_name();
529
+		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
530
+		$event_name = wp_trim_words($event_name, 30, '...');
531
+		if ($EVT_ID) {
532
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
533
+				array('action' => 'edit', 'post' => $EVT_ID),
534
+				EVENTS_ADMIN_URL
535
+			);
536
+			$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
537
+				? '<a class="ee-status-color-'
538
+				  . $this->_event_details['status']
539
+				  . '" href="'
540
+				  . $edit_event_url
541
+				  . '" title="'
542
+				  . esc_attr($this->_event_details['title_attr'])
543
+				  . '">'
544
+				  . $event_name
545
+				  . '</a>' : $event_name;
546
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
547
+			$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
548
+			$actions['event_filter'] .= sprintf(
549
+				esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
550
+				$event_name
551
+			);
552
+			$actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
553
+		} else {
554
+			$edit_event = $event_name;
555
+			$actions['event_filter'] = '';
556
+		}
557
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
558
+	}
559 559
 
560 560
 
561
-    /**
562
-     * column_DTT_EVT_start
563
-     *
564
-     * @access public
565
-     * @param \EE_Registration $item
566
-     * @return string
567
-     * @throws EE_Error
568
-     * @throws InvalidArgumentException
569
-     * @throws InvalidDataTypeException
570
-     * @throws InvalidInterfaceException
571
-     * @throws ReflectionException
572
-     */
573
-    public function column_DTT_EVT_start(EE_Registration $item)
574
-    {
575
-        $datetime_strings = array();
576
-        $ticket = $item->ticket(true);
577
-        if ($ticket instanceof EE_Ticket) {
578
-            $remove_defaults = array('default_where_conditions' => 'none');
579
-            $datetimes = $ticket->datetimes($remove_defaults);
580
-            foreach ($datetimes as $datetime) {
581
-                $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
582
-            }
583
-            return $this->generateDisplayForDatetimes($datetime_strings);
584
-        }
585
-        return __('There is no ticket on this registration', 'event_espresso');
586
-    }
561
+	/**
562
+	 * column_DTT_EVT_start
563
+	 *
564
+	 * @access public
565
+	 * @param \EE_Registration $item
566
+	 * @return string
567
+	 * @throws EE_Error
568
+	 * @throws InvalidArgumentException
569
+	 * @throws InvalidDataTypeException
570
+	 * @throws InvalidInterfaceException
571
+	 * @throws ReflectionException
572
+	 */
573
+	public function column_DTT_EVT_start(EE_Registration $item)
574
+	{
575
+		$datetime_strings = array();
576
+		$ticket = $item->ticket(true);
577
+		if ($ticket instanceof EE_Ticket) {
578
+			$remove_defaults = array('default_where_conditions' => 'none');
579
+			$datetimes = $ticket->datetimes($remove_defaults);
580
+			foreach ($datetimes as $datetime) {
581
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
582
+			}
583
+			return $this->generateDisplayForDatetimes($datetime_strings);
584
+		}
585
+		return __('There is no ticket on this registration', 'event_espresso');
586
+	}
587 587
 
588 588
 
589
-    /**
590
-     * Receives an array of datetime strings to display and converts them to the html container for the column.
591
-     *
592
-     * @param array $datetime_strings
593
-     * @return string
594
-     */
595
-    public function generateDisplayForDateTimes(array $datetime_strings)
596
-    {
597
-        $content = '<div class="ee-registration-event-datetimes-container">';
598
-        $expand_toggle = count($datetime_strings) > 1
599
-            ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso')
600
-              . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>'
601
-            : '';
602
-        //get first item for initial visibility
603
-        $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>';
604
-        $content .= $expand_toggle;
605
-        if ($datetime_strings) {
606
-            $content .= '<div style="clear:both"></div>';
607
-            $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">';
608
-            $content .= implode("<br />", $datetime_strings);
609
-            $content .= '</div>';
610
-        }
611
-        $content .= '</div>';
612
-        return $content;
613
-    }
589
+	/**
590
+	 * Receives an array of datetime strings to display and converts them to the html container for the column.
591
+	 *
592
+	 * @param array $datetime_strings
593
+	 * @return string
594
+	 */
595
+	public function generateDisplayForDateTimes(array $datetime_strings)
596
+	{
597
+		$content = '<div class="ee-registration-event-datetimes-container">';
598
+		$expand_toggle = count($datetime_strings) > 1
599
+			? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso')
600
+			  . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>'
601
+			: '';
602
+		//get first item for initial visibility
603
+		$content .= '<div class="left">' . array_shift($datetime_strings) . '</div>';
604
+		$content .= $expand_toggle;
605
+		if ($datetime_strings) {
606
+			$content .= '<div style="clear:both"></div>';
607
+			$content .= '<div class="ee-registration-event-datetimes-container more-items hidden">';
608
+			$content .= implode("<br />", $datetime_strings);
609
+			$content .= '</div>';
610
+		}
611
+		$content .= '</div>';
612
+		return $content;
613
+	}
614 614
 
615 615
 
616
-    /**
617
-     * column_ATT_fname
618
-     *
619
-     * @access public
620
-     * @param \EE_Registration $item
621
-     * @return string
622
-     * @throws EE_Error
623
-     * @throws InvalidArgumentException
624
-     * @throws InvalidDataTypeException
625
-     * @throws InvalidInterfaceException
626
-     * @throws ReflectionException
627
-     */
628
-    public function column_ATT_fname(EE_Registration $item)
629
-    {
630
-        $attendee = $item->attendee();
631
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
632
-            'action'  => 'view_registration',
633
-            '_REG_ID' => $item->ID(),
634
-        ), REG_ADMIN_URL);
635
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
636
-        $link = EE_Registry::instance()->CAP->current_user_can(
637
-            'ee_read_registration',
638
-            'espresso_registrations_view_registration',
639
-            $item->ID()
640
-        )
641
-            ? '<a href="'
642
-               . $edit_lnk_url
643
-               . '" title="'
644
-               . esc_attr__('View Registration Details', 'event_espresso')
645
-               . '">'
646
-               . $attendee_name
647
-               . '</a>' : $attendee_name;
648
-        $link .= $item->count() === 1
649
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
650
-        $t = $item->get_first_related('Transaction');
651
-        $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
652
-        //append group count to name
653
-        $link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
654
-        //append reg_code
655
-        $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
656
-        //reg status text for accessibility
657
-        $link .= '<br><span class="ee-status-text-small">'
658
-                 . EEH_Template::pretty_status($item->status_ID(), false, 'sentence')
659
-                 . '</span>';
660
-        //trash/restore/delete actions
661
-        $actions = array();
662
-        if ($this->_view !== 'trash'
663
-            && $payment_count === 0
664
-            && EE_Registry::instance()->CAP->current_user_can(
665
-                'ee_delete_registration',
666
-                'espresso_registrations_trash_registrations',
667
-                $item->ID()
668
-            )) {
669
-            $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
670
-                'action'  => 'trash_registrations',
671
-                '_REG_ID' => $item->ID(),
672
-            ), REG_ADMIN_URL);
673
-            $actions['trash'] = '<a href="'
674
-                                . $trash_lnk_url
675
-                                . '" title="'
676
-                                . esc_attr__('Trash Registration', 'event_espresso')
677
-                                . '">' . __('Trash', 'event_espresso') . '</a>';
678
-        } elseif ($this->_view === 'trash') {
679
-            // restore registration link
680
-            if (EE_Registry::instance()->CAP->current_user_can(
681
-                'ee_delete_registration',
682
-                'espresso_registrations_restore_registrations',
683
-                $item->ID()
684
-            )) {
685
-                $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
686
-                    'action'  => 'restore_registrations',
687
-                    '_REG_ID' => $item->ID(),
688
-                ), REG_ADMIN_URL);
689
-                $actions['restore'] = '<a href="'
690
-                                      . $restore_lnk_url
691
-                                      . '" title="'
692
-                                      . esc_attr__('Restore Registration', 'event_espresso') . '">'
693
-                                      . __('Restore', 'event_espresso') . '</a>';
694
-            }
695
-            if (EE_Registry::instance()->CAP->current_user_can(
696
-                'ee_delete_registration',
697
-                'espresso_registrations_ee_delete_registrations',
698
-                $item->ID()
699
-            )) {
700
-                $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
701
-                    'action'  => 'delete_registrations',
702
-                    '_REG_ID' => $item->ID(),
703
-                ), REG_ADMIN_URL);
704
-                $actions['delete'] = '<a href="'
705
-                                     . $delete_lnk_url
706
-                                     . '" title="'
707
-                                     . esc_attr__('Delete Registration Permanently', 'event_espresso')
708
-                                     . '">'
709
-                                     . __('Delete', 'event_espresso')
710
-                                     . '</a>';
711
-            }
712
-        }
713
-        return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
714
-    }
616
+	/**
617
+	 * column_ATT_fname
618
+	 *
619
+	 * @access public
620
+	 * @param \EE_Registration $item
621
+	 * @return string
622
+	 * @throws EE_Error
623
+	 * @throws InvalidArgumentException
624
+	 * @throws InvalidDataTypeException
625
+	 * @throws InvalidInterfaceException
626
+	 * @throws ReflectionException
627
+	 */
628
+	public function column_ATT_fname(EE_Registration $item)
629
+	{
630
+		$attendee = $item->attendee();
631
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
632
+			'action'  => 'view_registration',
633
+			'_REG_ID' => $item->ID(),
634
+		), REG_ADMIN_URL);
635
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
636
+		$link = EE_Registry::instance()->CAP->current_user_can(
637
+			'ee_read_registration',
638
+			'espresso_registrations_view_registration',
639
+			$item->ID()
640
+		)
641
+			? '<a href="'
642
+			   . $edit_lnk_url
643
+			   . '" title="'
644
+			   . esc_attr__('View Registration Details', 'event_espresso')
645
+			   . '">'
646
+			   . $attendee_name
647
+			   . '</a>' : $attendee_name;
648
+		$link .= $item->count() === 1
649
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
650
+		$t = $item->get_first_related('Transaction');
651
+		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
652
+		//append group count to name
653
+		$link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
654
+		//append reg_code
655
+		$link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
656
+		//reg status text for accessibility
657
+		$link .= '<br><span class="ee-status-text-small">'
658
+				 . EEH_Template::pretty_status($item->status_ID(), false, 'sentence')
659
+				 . '</span>';
660
+		//trash/restore/delete actions
661
+		$actions = array();
662
+		if ($this->_view !== 'trash'
663
+			&& $payment_count === 0
664
+			&& EE_Registry::instance()->CAP->current_user_can(
665
+				'ee_delete_registration',
666
+				'espresso_registrations_trash_registrations',
667
+				$item->ID()
668
+			)) {
669
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
670
+				'action'  => 'trash_registrations',
671
+				'_REG_ID' => $item->ID(),
672
+			), REG_ADMIN_URL);
673
+			$actions['trash'] = '<a href="'
674
+								. $trash_lnk_url
675
+								. '" title="'
676
+								. esc_attr__('Trash Registration', 'event_espresso')
677
+								. '">' . __('Trash', 'event_espresso') . '</a>';
678
+		} elseif ($this->_view === 'trash') {
679
+			// restore registration link
680
+			if (EE_Registry::instance()->CAP->current_user_can(
681
+				'ee_delete_registration',
682
+				'espresso_registrations_restore_registrations',
683
+				$item->ID()
684
+			)) {
685
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
686
+					'action'  => 'restore_registrations',
687
+					'_REG_ID' => $item->ID(),
688
+				), REG_ADMIN_URL);
689
+				$actions['restore'] = '<a href="'
690
+									  . $restore_lnk_url
691
+									  . '" title="'
692
+									  . esc_attr__('Restore Registration', 'event_espresso') . '">'
693
+									  . __('Restore', 'event_espresso') . '</a>';
694
+			}
695
+			if (EE_Registry::instance()->CAP->current_user_can(
696
+				'ee_delete_registration',
697
+				'espresso_registrations_ee_delete_registrations',
698
+				$item->ID()
699
+			)) {
700
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
701
+					'action'  => 'delete_registrations',
702
+					'_REG_ID' => $item->ID(),
703
+				), REG_ADMIN_URL);
704
+				$actions['delete'] = '<a href="'
705
+									 . $delete_lnk_url
706
+									 . '" title="'
707
+									 . esc_attr__('Delete Registration Permanently', 'event_espresso')
708
+									 . '">'
709
+									 . __('Delete', 'event_espresso')
710
+									 . '</a>';
711
+			}
712
+		}
713
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
714
+	}
715 715
 
716 716
 
717
-    /**
718
-     * column_ATT_email
719
-     *
720
-     * @access public
721
-     * @param \EE_Registration $item
722
-     * @return string
723
-     * @throws EE_Error
724
-     * @throws InvalidArgumentException
725
-     * @throws InvalidDataTypeException
726
-     * @throws InvalidInterfaceException
727
-     * @throws ReflectionException
728
-     */
729
-    public function column_ATT_email(EE_Registration $item)
730
-    {
731
-        $attendee = $item->get_first_related('Attendee');
732
-        return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso')
733
-            : $attendee->email();
734
-    }
717
+	/**
718
+	 * column_ATT_email
719
+	 *
720
+	 * @access public
721
+	 * @param \EE_Registration $item
722
+	 * @return string
723
+	 * @throws EE_Error
724
+	 * @throws InvalidArgumentException
725
+	 * @throws InvalidDataTypeException
726
+	 * @throws InvalidInterfaceException
727
+	 * @throws ReflectionException
728
+	 */
729
+	public function column_ATT_email(EE_Registration $item)
730
+	{
731
+		$attendee = $item->get_first_related('Attendee');
732
+		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso')
733
+			: $attendee->email();
734
+	}
735 735
 
736 736
 
737
-    /**
738
-     * column__REG_count
739
-     *
740
-     * @access public
741
-     * @param \EE_Registration $item
742
-     * @return string
743
-     */
744
-    public function column__REG_count(EE_Registration $item)
745
-    {
746
-        return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
747
-    }
737
+	/**
738
+	 * column__REG_count
739
+	 *
740
+	 * @access public
741
+	 * @param \EE_Registration $item
742
+	 * @return string
743
+	 */
744
+	public function column__REG_count(EE_Registration $item)
745
+	{
746
+		return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
747
+	}
748 748
 
749 749
 
750
-    /**
751
-     * column_PRC_amount
752
-     *
753
-     * @access public
754
-     * @param \EE_Registration $item
755
-     * @return string
756
-     * @throws EE_Error
757
-     */
758
-    public function column_PRC_amount(EE_Registration $item)
759
-    {
760
-        $ticket = $item->ticket();
761
-        $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'
762
-                                                                              . $ticket->name()
763
-                                                                              . '</span><br />' : '';
764
-        if ($item->final_price() > 0) {
765
-            $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
766
-        } else {
767
-            // free event
768
-            $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
769
-                        . __('free', 'event_espresso')
770
-                        . '</span>';
771
-        }
772
-        return $content;
773
-    }
750
+	/**
751
+	 * column_PRC_amount
752
+	 *
753
+	 * @access public
754
+	 * @param \EE_Registration $item
755
+	 * @return string
756
+	 * @throws EE_Error
757
+	 */
758
+	public function column_PRC_amount(EE_Registration $item)
759
+	{
760
+		$ticket = $item->ticket();
761
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'
762
+																			  . $ticket->name()
763
+																			  . '</span><br />' : '';
764
+		if ($item->final_price() > 0) {
765
+			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
766
+		} else {
767
+			// free event
768
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
769
+						. __('free', 'event_espresso')
770
+						. '</span>';
771
+		}
772
+		return $content;
773
+	}
774 774
 
775 775
 
776
-    /**
777
-     * column__REG_final_price
778
-     *
779
-     * @access public
780
-     * @param \EE_Registration $item
781
-     * @return string
782
-     * @throws EE_Error
783
-     */
784
-    public function column__REG_final_price(EE_Registration $item)
785
-    {
786
-        $ticket = $item->ticket();
787
-        $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket
788
-            ? ''
789
-            : '<span class="TKT_name">'
790
-              . $ticket->name()
791
-              . '</span><br />';
792
-        $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
793
-        return $content;
794
-    }
776
+	/**
777
+	 * column__REG_final_price
778
+	 *
779
+	 * @access public
780
+	 * @param \EE_Registration $item
781
+	 * @return string
782
+	 * @throws EE_Error
783
+	 */
784
+	public function column__REG_final_price(EE_Registration $item)
785
+	{
786
+		$ticket = $item->ticket();
787
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket
788
+			? ''
789
+			: '<span class="TKT_name">'
790
+			  . $ticket->name()
791
+			  . '</span><br />';
792
+		$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
793
+		return $content;
794
+	}
795 795
 
796 796
 
797
-    /**
798
-     * column__REG_paid
799
-     *
800
-     * @access public
801
-     * @param \EE_Registration $item
802
-     * @return string
803
-     * @throws EE_Error
804
-     */
805
-    public function column__REG_paid(EE_Registration $item)
806
-    {
807
-        $payment_method = $item->payment_method();
808
-        $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
809
-            : __('Unknown', 'event_espresso');
810
-        $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
811
-        if ($item->paid() > 0) {
812
-            $content .= '<br><span class="ee-status-text-small">'
813
-                        . sprintf(
814
-                            __('...via %s', 'event_espresso'),
815
-                            $payment_method_name
816
-                        )
817
-                        . '</span>';
818
-        }
819
-        return $content;
820
-    }
797
+	/**
798
+	 * column__REG_paid
799
+	 *
800
+	 * @access public
801
+	 * @param \EE_Registration $item
802
+	 * @return string
803
+	 * @throws EE_Error
804
+	 */
805
+	public function column__REG_paid(EE_Registration $item)
806
+	{
807
+		$payment_method = $item->payment_method();
808
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
809
+			: __('Unknown', 'event_espresso');
810
+		$content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
811
+		if ($item->paid() > 0) {
812
+			$content .= '<br><span class="ee-status-text-small">'
813
+						. sprintf(
814
+							__('...via %s', 'event_espresso'),
815
+							$payment_method_name
816
+						)
817
+						. '</span>';
818
+		}
819
+		return $content;
820
+	}
821 821
 
822 822
 
823
-    /**
824
-     * column_TXN_total
825
-     *
826
-     * @access public
827
-     * @param \EE_Registration $item
828
-     * @return string
829
-     * @throws EE_Error
830
-     * @throws EntityNotFoundException
831
-     * @throws InvalidArgumentException
832
-     * @throws InvalidDataTypeException
833
-     * @throws InvalidInterfaceException
834
-     */
835
-    public function column_TXN_total(EE_Registration $item)
836
-    {
837
-        if ($item->transaction()) {
838
-            $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
839
-                'action' => 'view_transaction',
840
-                'TXN_ID' => $item->transaction_ID(),
841
-            ), TXN_ADMIN_URL);
842
-            return EE_Registry::instance()->CAP->current_user_can(
843
-                'ee_read_transaction',
844
-                'espresso_transactions_view_transaction',
845
-                $item->transaction_ID()
846
-            )
847
-                ? '<span class="reg-pad-rght"><a class="status-'
848
-                  . $item->transaction()->status_ID()
849
-                  . '" href="'
850
-                  . $view_txn_lnk_url
851
-                  . '"  title="'
852
-                  . esc_attr__('View Transaction', 'event_espresso')
853
-                  . '">'
854
-                  . $item->transaction()->pretty_total()
855
-                  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
856
-        } else {
857
-            return __("None", "event_espresso");
858
-        }
859
-    }
823
+	/**
824
+	 * column_TXN_total
825
+	 *
826
+	 * @access public
827
+	 * @param \EE_Registration $item
828
+	 * @return string
829
+	 * @throws EE_Error
830
+	 * @throws EntityNotFoundException
831
+	 * @throws InvalidArgumentException
832
+	 * @throws InvalidDataTypeException
833
+	 * @throws InvalidInterfaceException
834
+	 */
835
+	public function column_TXN_total(EE_Registration $item)
836
+	{
837
+		if ($item->transaction()) {
838
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
839
+				'action' => 'view_transaction',
840
+				'TXN_ID' => $item->transaction_ID(),
841
+			), TXN_ADMIN_URL);
842
+			return EE_Registry::instance()->CAP->current_user_can(
843
+				'ee_read_transaction',
844
+				'espresso_transactions_view_transaction',
845
+				$item->transaction_ID()
846
+			)
847
+				? '<span class="reg-pad-rght"><a class="status-'
848
+				  . $item->transaction()->status_ID()
849
+				  . '" href="'
850
+				  . $view_txn_lnk_url
851
+				  . '"  title="'
852
+				  . esc_attr__('View Transaction', 'event_espresso')
853
+				  . '">'
854
+				  . $item->transaction()->pretty_total()
855
+				  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
856
+		} else {
857
+			return __("None", "event_espresso");
858
+		}
859
+	}
860 860
 
861 861
 
862
-    /**
863
-     * column_TXN_paid
864
-     *
865
-     * @access public
866
-     * @param \EE_Registration $item
867
-     * @return string
868
-     * @throws EE_Error
869
-     * @throws EntityNotFoundException
870
-     * @throws InvalidArgumentException
871
-     * @throws InvalidDataTypeException
872
-     * @throws InvalidInterfaceException
873
-     */
874
-    public function column_TXN_paid(EE_Registration $item)
875
-    {
876
-        if ($item->count() === 1) {
877
-            $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
878
-            if ($transaction->paid() >= $transaction->total()) {
879
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
880
-            } else {
881
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
882
-                    'action' => 'view_transaction',
883
-                    'TXN_ID' => $item->transaction_ID(),
884
-                ), TXN_ADMIN_URL);
885
-                return EE_Registry::instance()->CAP->current_user_can(
886
-                    'ee_read_transaction',
887
-                    'espresso_transactions_view_transaction',
888
-                    $item->transaction_ID()
889
-                )
890
-                    ? '<span class="reg-pad-rght"><a class="status-'
891
-                      . $transaction->status_ID()
892
-                      . '" href="'
893
-                      . $view_txn_lnk_url
894
-                      . '"  title="'
895
-                      . esc_attr__('View Transaction', 'event_espresso')
896
-                      . '">'
897
-                      . $item->transaction()->pretty_paid()
898
-                      . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
899
-            }
900
-        }
901
-        return '&nbsp;';
902
-    }
862
+	/**
863
+	 * column_TXN_paid
864
+	 *
865
+	 * @access public
866
+	 * @param \EE_Registration $item
867
+	 * @return string
868
+	 * @throws EE_Error
869
+	 * @throws EntityNotFoundException
870
+	 * @throws InvalidArgumentException
871
+	 * @throws InvalidDataTypeException
872
+	 * @throws InvalidInterfaceException
873
+	 */
874
+	public function column_TXN_paid(EE_Registration $item)
875
+	{
876
+		if ($item->count() === 1) {
877
+			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
878
+			if ($transaction->paid() >= $transaction->total()) {
879
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
880
+			} else {
881
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
882
+					'action' => 'view_transaction',
883
+					'TXN_ID' => $item->transaction_ID(),
884
+				), TXN_ADMIN_URL);
885
+				return EE_Registry::instance()->CAP->current_user_can(
886
+					'ee_read_transaction',
887
+					'espresso_transactions_view_transaction',
888
+					$item->transaction_ID()
889
+				)
890
+					? '<span class="reg-pad-rght"><a class="status-'
891
+					  . $transaction->status_ID()
892
+					  . '" href="'
893
+					  . $view_txn_lnk_url
894
+					  . '"  title="'
895
+					  . esc_attr__('View Transaction', 'event_espresso')
896
+					  . '">'
897
+					  . $item->transaction()->pretty_paid()
898
+					  . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
899
+			}
900
+		}
901
+		return '&nbsp;';
902
+	}
903 903
 
904 904
 
905
-    /**
906
-     * column_actions
907
-     *
908
-     * @access public
909
-     * @param \EE_Registration $item
910
-     * @return string
911
-     * @throws EE_Error
912
-     * @throws InvalidArgumentException
913
-     * @throws InvalidDataTypeException
914
-     * @throws InvalidInterfaceException
915
-     * @throws ReflectionException
916
-     */
917
-    public function column_actions(EE_Registration $item)
918
-    {
919
-        $actions = array();
920
-        $attendee = $item->attendee();
921
-        $this->_set_related_details($item);
922
-        //Build row actions
923
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
924
-            'action'  => 'view_registration',
925
-            '_REG_ID' => $item->ID(),
926
-        ), REG_ADMIN_URL);
927
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
928
-            'action' => 'edit_attendee',
929
-            'post'   => $item->attendee_ID(),
930
-        ), REG_ADMIN_URL);
931
-        // page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
932
-        //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
933
-        $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
934
-            'action'  => 'resend_registration',
935
-            '_REG_ID' => $item->ID(),
936
-        ), REG_ADMIN_URL, true);
937
-        //Build row actions
938
-        $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can(
939
-            'ee_read_registration',
940
-            'espresso_registrations_view_registration',
941
-            $item->ID()
942
-        ) ? '<li><a href="'
943
-            . $view_lnk_url
944
-            . '" title="'
945
-            . esc_attr__('View Registration Details', 'event_espresso')
946
-            . '" class="tiny-text">
905
+	/**
906
+	 * column_actions
907
+	 *
908
+	 * @access public
909
+	 * @param \EE_Registration $item
910
+	 * @return string
911
+	 * @throws EE_Error
912
+	 * @throws InvalidArgumentException
913
+	 * @throws InvalidDataTypeException
914
+	 * @throws InvalidInterfaceException
915
+	 * @throws ReflectionException
916
+	 */
917
+	public function column_actions(EE_Registration $item)
918
+	{
919
+		$actions = array();
920
+		$attendee = $item->attendee();
921
+		$this->_set_related_details($item);
922
+		//Build row actions
923
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
924
+			'action'  => 'view_registration',
925
+			'_REG_ID' => $item->ID(),
926
+		), REG_ADMIN_URL);
927
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
928
+			'action' => 'edit_attendee',
929
+			'post'   => $item->attendee_ID(),
930
+		), REG_ADMIN_URL);
931
+		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
932
+		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
933
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
934
+			'action'  => 'resend_registration',
935
+			'_REG_ID' => $item->ID(),
936
+		), REG_ADMIN_URL, true);
937
+		//Build row actions
938
+		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can(
939
+			'ee_read_registration',
940
+			'espresso_registrations_view_registration',
941
+			$item->ID()
942
+		) ? '<li><a href="'
943
+			. $view_lnk_url
944
+			. '" title="'
945
+			. esc_attr__('View Registration Details', 'event_espresso')
946
+			. '" class="tiny-text">
947 947
 				<div class="dashicons dashicons-clipboard"></div>
948 948
 			</a>
949 949
 			</li>'
950
-            : '';
951
-        $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can(
952
-            'ee_edit_contacts',
953
-            'espresso_registrations_edit_attendee'
954
-        )
955
-                               && $attendee instanceof EE_Attendee
956
-            ? '
950
+			: '';
951
+		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can(
952
+			'ee_edit_contacts',
953
+			'espresso_registrations_edit_attendee'
954
+		)
955
+							   && $attendee instanceof EE_Attendee
956
+			? '
957 957
 			<li>
958 958
 			<a href="' . $edit_lnk_url . '" title="'
959
-              . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text">
959
+			  . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text">
960 960
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
961 961
 			</a>
962 962
 			</li>' : '';
963
-        $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee
964
-                                     && EE_Registry::instance()->CAP->current_user_can(
965
-                                         'ee_send_message',
966
-                                         'espresso_registrations_resend_registration',
967
-                                         $item->ID()
968
-        )
969
-            ? '
963
+		$actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee
964
+									 && EE_Registry::instance()->CAP->current_user_can(
965
+										 'ee_send_message',
966
+										 'espresso_registrations_resend_registration',
967
+										 $item->ID()
968
+		)
969
+			? '
970 970
 			<li>
971 971
 			<a href="'
972
-                 . $resend_reg_lnk_url
973
-                 . '" title="'
974
-                 . esc_attr__('Resend Registration Details', 'event_espresso')
975
-                 . '" class="tiny-text">
972
+				 . $resend_reg_lnk_url
973
+				 . '" title="'
974
+				 . esc_attr__('Resend Registration Details', 'event_espresso')
975
+				 . '" class="tiny-text">
976 976
 				<div class="dashicons dashicons-email-alt"></div>
977 977
 			</a>
978 978
 			</li>' : '';
979
-        // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
980
-        $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
981
-            'action' => 'view_transaction',
982
-            'TXN_ID' => $this->_transaction_details['id'],
983
-        ), TXN_ADMIN_URL);
984
-        $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can(
985
-            'ee_read_transaction',
986
-            'espresso_transactions_view_transaction',
987
-            $this->_transaction_details['id']
988
-        )
989
-            ? '
979
+		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
980
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
981
+			'action' => 'view_transaction',
982
+			'TXN_ID' => $this->_transaction_details['id'],
983
+		), TXN_ADMIN_URL);
984
+		$actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can(
985
+			'ee_read_transaction',
986
+			'espresso_transactions_view_transaction',
987
+			$this->_transaction_details['id']
988
+		)
989
+			? '
990 990
 			<li>
991 991
 			<a class="ee-status-color-'
992
-               . $this->_transaction_details['status']
993
-               . ' tiny-text" href="'
994
-               . $view_txn_lnk_url
995
-               . '"  title="'
996
-               . $this->_transaction_details['title_attr']
997
-               . '">
992
+			   . $this->_transaction_details['status']
993
+			   . ' tiny-text" href="'
994
+			   . $view_txn_lnk_url
995
+			   . '"  title="'
996
+			   . $this->_transaction_details['title_attr']
997
+			   . '">
998 998
 				<div class="dashicons dashicons-cart"></div>
999 999
 			</a>
1000 1000
 			</li>' : '';
1001
-        //invoice link
1002
-        $actions['dl_invoice_lnk'] = '';
1003
-        $dl_invoice_lnk_url = $item->invoice_url();
1004
-        //only show invoice link if message type is active.
1005
-        if ($attendee instanceof EE_Attendee
1006
-            && $item->is_primary_registrant()
1007
-            && EEH_MSG_Template::is_mt_active('invoice')
1008
-        ) {
1009
-            $actions['dl_invoice_lnk'] = '
1001
+		//invoice link
1002
+		$actions['dl_invoice_lnk'] = '';
1003
+		$dl_invoice_lnk_url = $item->invoice_url();
1004
+		//only show invoice link if message type is active.
1005
+		if ($attendee instanceof EE_Attendee
1006
+			&& $item->is_primary_registrant()
1007
+			&& EEH_MSG_Template::is_mt_active('invoice')
1008
+		) {
1009
+			$actions['dl_invoice_lnk'] = '
1010 1010
 		<li>
1011 1011
 			<a title="'
1012
-                 . esc_attr__('View Transaction Invoice', 'event_espresso')
1013
-                 . '" target="_blank" href="'
1014
-                 . $dl_invoice_lnk_url
1015
-                 . '" class="tiny-text">
1012
+				 . esc_attr__('View Transaction Invoice', 'event_espresso')
1013
+				 . '" target="_blank" href="'
1014
+				 . $dl_invoice_lnk_url
1015
+				 . '" class="tiny-text">
1016 1016
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
1017 1017
 			</a>
1018 1018
 		</li>';
1019
-        }
1020
-        $actions['filtered_messages_link'] = '';
1021
-        //message list table link (filtered by REG_ID
1022
-        if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
1023
-            $actions['filtered_messages_link'] = '<li>'
1024
-                     . EEH_MSG_Template::get_message_action_link(
1025
-                         'see_notifications_for',
1026
-                         null,
1027
-                         array('_REG_ID' => $item->ID())
1028
-                     ) . '</li>';
1029
-        }
1030
-        $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
1031
-        return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
1032
-    }
1019
+		}
1020
+		$actions['filtered_messages_link'] = '';
1021
+		//message list table link (filtered by REG_ID
1022
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
1023
+			$actions['filtered_messages_link'] = '<li>'
1024
+					 . EEH_MSG_Template::get_message_action_link(
1025
+						 'see_notifications_for',
1026
+						 null,
1027
+						 array('_REG_ID' => $item->ID())
1028
+					 ) . '</li>';
1029
+		}
1030
+		$actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
1031
+		return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
1032
+	}
1033 1033
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 use EventEspresso\core\exceptions\InvalidDataTypeException;
3 3
 use EventEspresso\core\exceptions\InvalidInterfaceException;
4 4
 
5
-if (! defined('EVENT_ESPRESSO_VERSION')) {
5
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
6 6
     exit('No direct script access allowed');
7 7
 }
8 8
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function __construct(Registrations_Admin_Page $admin_page)
59 59
     {
60
-        if (! empty($_GET['event_id'])) {
60
+        if ( ! empty($_GET['event_id'])) {
61 61
             $extra_query_args = array();
62 62
             foreach ($admin_page->get_views() as $key => $view_details) {
63 63
                 $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         );
158 158
         $this->_primary_column = '_REG_ID';
159 159
         $this->_sortable_columns = array(
160
-            '_REG_date'     => array('_REG_date' => true),   //true means its already sorted
160
+            '_REG_date'     => array('_REG_date' => true), //true means its already sorted
161 161
             /**
162 162
              * Allows users to change the default sort if they wish.
163 163
              * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         $class = parent::_get_row_class($item);
191 191
         //add status class
192
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
192
+        $class .= ' ee-status-strip reg-status-'.$item->status_ID();
193 193
         if ($this->_has_checkbox_column) {
194 194
             $class .= ' has-checkbox-column';
195 195
         }
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
         //setup date query.
355 355
         $beginning_string = EEM_Registration::instance()->convert_datetime_for_query(
356 356
             'REG_date',
357
-            $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
357
+            $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start,
358 358
             'Y-m-d H:i:s'
359 359
         );
360 360
         $end_string = EEM_Registration::instance()->convert_datetime_for_query(
361 361
             'REG_date',
362
-            $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
362
+            $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end,
363 363
             'Y-m-d H:i:s'
364 364
         );
365 365
         $_where['REG_date'] = array(
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
             array(
397 397
                 EEM_Registration::instance()->convert_datetime_for_query(
398 398
                     'REG_date',
399
-                    $current_date . $time_start,
399
+                    $current_date.$time_start,
400 400
                     'Y-m-d H:i:s'
401 401
                 ),
402 402
                 EEM_Registration::instance()->convert_datetime_for_query(
403 403
                     'REG_date',
404
-                    $current_date . $time_end,
404
+                    $current_date.$time_end,
405 405
                     'Y-m-d H:i:s'
406 406
                 ),
407 407
             ),
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
         $content .= '<div class="show-on-mobile-view-only">';
462 462
         $content .= '<br>';
463 463
         $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
464
-        $content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
465
-        $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
464
+        $content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
465
+        $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
466 466
         $content .= '</div>';
467 467
         return $content;
468 468
     }
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
                   . $event_name
545 545
                   . '</a>' : $event_name;
546 546
             $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
547
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
547
+            $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="';
548 548
             $actions['event_filter'] .= sprintf(
549 549
                 esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
550 550
                 $event_name
551 551
             );
552
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
552
+            $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>';
553 553
         } else {
554 554
             $edit_event = $event_name;
555 555
             $actions['event_filter'] = '';
@@ -596,11 +596,11 @@  discard block
 block discarded – undo
596 596
     {
597 597
         $content = '<div class="ee-registration-event-datetimes-container">';
598 598
         $expand_toggle = count($datetime_strings) > 1
599
-            ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso')
599
+            ? ' <span title="'.esc_attr__('Click to view all dates', 'event_espresso')
600 600
               . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>'
601 601
             : '';
602 602
         //get first item for initial visibility
603
-        $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>';
603
+        $content .= '<div class="left">'.array_shift($datetime_strings).'</div>';
604 604
         $content .= $expand_toggle;
605 605
         if ($datetime_strings) {
606 606
             $content .= '<div style="clear:both"></div>';
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
         $t = $item->get_first_related('Transaction');
651 651
         $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
652 652
         //append group count to name
653
-        $link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
653
+        $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
654 654
         //append reg_code
655
-        $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
655
+        $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
656 656
         //reg status text for accessibility
657 657
         $link .= '<br><span class="ee-status-text-small">'
658 658
                  . EEH_Template::pretty_status($item->status_ID(), false, 'sentence')
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                                 . $trash_lnk_url
675 675
                                 . '" title="'
676 676
                                 . esc_attr__('Trash Registration', 'event_espresso')
677
-                                . '">' . __('Trash', 'event_espresso') . '</a>';
677
+                                . '">'.__('Trash', 'event_espresso').'</a>';
678 678
         } elseif ($this->_view === 'trash') {
679 679
             // restore registration link
680 680
             if (EE_Registry::instance()->CAP->current_user_can(
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
                 $actions['restore'] = '<a href="'
690 690
                                       . $restore_lnk_url
691 691
                                       . '" title="'
692
-                                      . esc_attr__('Restore Registration', 'event_espresso') . '">'
693
-                                      . __('Restore', 'event_espresso') . '</a>';
692
+                                      . esc_attr__('Restore Registration', 'event_espresso').'">'
693
+                                      . __('Restore', 'event_espresso').'</a>';
694 694
             }
695 695
             if (EE_Registry::instance()->CAP->current_user_can(
696 696
                 'ee_delete_registration',
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
                                                                               . $ticket->name()
763 763
                                                                               . '</span><br />' : '';
764 764
         if ($item->final_price() > 0) {
765
-            $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
765
+            $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
766 766
         } else {
767 767
             // free event
768 768
             $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
             : '<span class="TKT_name">'
790 790
               . $ticket->name()
791 791
               . '</span><br />';
792
-        $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
792
+        $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
793 793
         return $content;
794 794
     }
795 795
 
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
         $payment_method = $item->payment_method();
808 808
         $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
809 809
             : __('Unknown', 'event_espresso');
810
-        $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
810
+        $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
811 811
         if ($item->paid() > 0) {
812 812
             $content .= '<br><span class="ee-status-text-small">'
813 813
                         . sprintf(
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
                   . esc_attr__('View Transaction', 'event_espresso')
853 853
                   . '">'
854 854
                   . $item->transaction()->pretty_total()
855
-                  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
855
+                  . '</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
856 856
         } else {
857 857
             return __("None", "event_espresso");
858 858
         }
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
                       . esc_attr__('View Transaction', 'event_espresso')
896 896
                       . '">'
897 897
                       . $item->transaction()->pretty_paid()
898
-                      . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
898
+                      . '</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
899 899
             }
900 900
         }
901 901
         return '&nbsp;';
@@ -955,8 +955,8 @@  discard block
 block discarded – undo
955 955
                                && $attendee instanceof EE_Attendee
956 956
             ? '
957 957
 			<li>
958
-			<a href="' . $edit_lnk_url . '" title="'
959
-              . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text">
958
+			<a href="' . $edit_lnk_url.'" title="'
959
+              . esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
960 960
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
961 961
 			</a>
962 962
 			</li>' : '';
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
                          'see_notifications_for',
1026 1026
                          null,
1027 1027
                          array('_REG_ID' => $item->ID())
1028
-                     ) . '</li>';
1028
+                     ).'</li>';
1029 1029
         }
1030 1030
         $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
1031 1031
         return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
Please login to merge, or discard this patch.
admin_pages/maintenance/Maintenance_Admin_Page_Init.core.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -29,91 +29,91 @@  discard block
 block discarded – undo
29 29
 {
30 30
 
31 31
 
32
-    public function __construct()
33
-    {
34
-        //define some page related constants
35
-        define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso'));
36
-        define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings');
37
-        define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG));
38
-        define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS);
39
-        define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS);
40
-        define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/');
41
-        //check that if we're in maintenance mode that we tell the admin that
42
-        add_action('admin_notices', array($this, 'check_maintenance_mode'));
43
-        parent::__construct();
44
-    }
45
-
46
-
47
-
48
-    protected function _set_init_properties()
49
-    {
50
-        $this->label = EE_MAINTENANCE_LABEL;
51
-    }
52
-
53
-
54
-
55
-    protected function _set_menu_map()
56
-    {
57
-        $menu_map = $this->_menu_map();
58
-        $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance
59
-            ? new EE_Admin_Page_Main_Menu($menu_map) : new EE_Admin_Page_Sub_Menu($menu_map);
60
-    }
61
-
62
-
63
-
64
-    protected function _menu_map()
65
-    {
66
-        $map = array(
67
-            'menu_group'              => 'extras',
68
-            'menu_order'              => 30,
69
-            'show_on_menu'            => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
70
-            'parent_slug'             => 'espresso_events',
71
-            'menu_slug'               => EE_MAINTENANCE_PG_SLUG,
72
-            'menu_label'              => EE_MAINTENANCE_LABEL,
73
-            'capability'              => 'manage_options',
74
-            'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG,
75
-            'admin_init_page'         => $this,
76
-        );
77
-        if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
78
-            $map['menu_group'] = 'main';
79
-            $map['subtitle'] = EE_MAINTENANCE_LABEL;
80
-            $map['menu_label'] = __('Event Espresso', 'event_espresso');
81
-        }
82
-        return $map;
83
-    }
84
-
85
-
86
-
87
-    /**
88
-     * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of
89
-     * maintenance mode
90
-     */
91
-    public function check_maintenance_mode()
92
-    {
93
-        $notice = '';
94
-        $maintenance_page_url = '';
95
-        if (EE_Maintenance_Mode::instance()->level()) {
96
-            $maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL);
97
-            switch (EE_Maintenance_Mode::instance()->level()) {
98
-                case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
99
-                    $notice = '<div class="update-nag">
32
+	public function __construct()
33
+	{
34
+		//define some page related constants
35
+		define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso'));
36
+		define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings');
37
+		define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG));
38
+		define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS);
39
+		define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS);
40
+		define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/');
41
+		//check that if we're in maintenance mode that we tell the admin that
42
+		add_action('admin_notices', array($this, 'check_maintenance_mode'));
43
+		parent::__construct();
44
+	}
45
+
46
+
47
+
48
+	protected function _set_init_properties()
49
+	{
50
+		$this->label = EE_MAINTENANCE_LABEL;
51
+	}
52
+
53
+
54
+
55
+	protected function _set_menu_map()
56
+	{
57
+		$menu_map = $this->_menu_map();
58
+		$this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance
59
+			? new EE_Admin_Page_Main_Menu($menu_map) : new EE_Admin_Page_Sub_Menu($menu_map);
60
+	}
61
+
62
+
63
+
64
+	protected function _menu_map()
65
+	{
66
+		$map = array(
67
+			'menu_group'              => 'extras',
68
+			'menu_order'              => 30,
69
+			'show_on_menu'            => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
70
+			'parent_slug'             => 'espresso_events',
71
+			'menu_slug'               => EE_MAINTENANCE_PG_SLUG,
72
+			'menu_label'              => EE_MAINTENANCE_LABEL,
73
+			'capability'              => 'manage_options',
74
+			'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG,
75
+			'admin_init_page'         => $this,
76
+		);
77
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
78
+			$map['menu_group'] = 'main';
79
+			$map['subtitle'] = EE_MAINTENANCE_LABEL;
80
+			$map['menu_label'] = __('Event Espresso', 'event_espresso');
81
+		}
82
+		return $map;
83
+	}
84
+
85
+
86
+
87
+	/**
88
+	 * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of
89
+	 * maintenance mode
90
+	 */
91
+	public function check_maintenance_mode()
92
+	{
93
+		$notice = '';
94
+		$maintenance_page_url = '';
95
+		if (EE_Maintenance_Mode::instance()->level()) {
96
+			$maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL);
97
+			switch (EE_Maintenance_Mode::instance()->level()) {
98
+				case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
99
+					$notice = '<div class="update-nag">
100 100
 						'
101
-                              . 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.",
102
-                            "event_espresso"), "<a href='$maintenance_page_url'>", "</a>")
103
-                              .
104
-                              '</div>';
105
-                    break;
106
-                case EE_Maintenance_Mode::level_2_complete_maintenance:
107
-                    $notice = '<div class="error">
101
+							  . 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.",
102
+							"event_espresso"), "<a href='$maintenance_page_url'>", "</a>")
103
+							  .
104
+							  '</div>';
105
+					break;
106
+				case EE_Maintenance_Mode::level_2_complete_maintenance:
107
+					$notice = '<div class="error">
108 108
 						<p>' . sprintf(__("As part of the process for updating Event Espresso, your database also
109 109
 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.",
110
-                            "event_espresso"), "<a href='$maintenance_page_url'>", "</a>") .
111
-                              '</div>';
112
-                    break;
113
-            }
114
-        }
115
-        echo apply_filters('FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', $notice,
116
-            $maintenance_page_url);
117
-    }
110
+							"event_espresso"), "<a href='$maintenance_page_url'>", "</a>") .
111
+							  '</div>';
112
+					break;
113
+			}
114
+		}
115
+		echo apply_filters('FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', $notice,
116
+			$maintenance_page_url);
117
+	}
118 118
 
119 119
 } //end class Payments_Admin_Page_Init
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
         //define some page related constants
35 35
         define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso'));
36 36
         define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings');
37
-        define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG));
38
-        define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS);
39
-        define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS);
40
-        define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/');
37
+        define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page='.EE_MAINTENANCE_PG_SLUG));
38
+        define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES.'maintenance'.DS);
39
+        define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN.'templates'.DS);
40
+        define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL.'maintenance/assets/');
41 41
         //check that if we're in maintenance mode that we tell the admin that
42 42
         add_action('admin_notices', array($this, 'check_maintenance_mode'));
43 43
         parent::__construct();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     $notice = '<div class="error">
108 108
 						<p>' . sprintf(__("As part of the process for updating Event Espresso, your database also
109 109
 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.",
110
-                            "event_espresso"), "<a href='$maintenance_page_url'>", "</a>") .
110
+                            "event_espresso"), "<a href='$maintenance_page_url'>", "</a>").
111 111
                               '</div>';
112 112
                     break;
113 113
             }
Please login to merge, or discard this patch.
modules/invalid_checkout_access/InvalidCheckoutAccess.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 		if (
40 40
 			! ( $checkout->uts || $checkout->reg_url_link )
41 41
 			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
42
-            && \EE_Config::instance()->registration->track_invalid_checkout_access()
43
-        ) {
42
+			&& \EE_Config::instance()->registration->track_invalid_checkout_access()
43
+		) {
44 44
 			/** @var \EE_Request $request */
45 45
 			$request = \EE_Registry::instance()->load_core( 'EE_Request' );
46 46
 			$ip_address = $request->ip_address();
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 			}
61 61
 			$ee_bot_checkout[ $ip_address ][ $http_referer ]++;
62 62
 			update_option( InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout );
63
-            if (WP_DEBUG) {
64
-                \EE_Error::add_error(
65
-                    esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'),
66
-                    __FILE__,
67
-                    __FUNCTION__,
68
-                    __LINE__
69
-                );
70
-            }
63
+			if (WP_DEBUG) {
64
+				\EE_Error::add_error(
65
+					esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'),
66
+					__FILE__,
67
+					__FUNCTION__,
68
+					__LINE__
69
+				);
70
+			}
71 71
 			return true;
72 72
 		}
73 73
 		return false;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\modules\invalid_checkout_access;
3 3
 
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
 
@@ -35,31 +35,31 @@  discard block
 block discarded – undo
35 35
 	 * @param \EE_Checkout $checkout
36 36
 	 * @return bool true if access to registration checkout appears to be invalid
37 37
 	 */
38
-	public function checkoutAccessIsInvalid( \EE_Checkout $checkout ) {
38
+	public function checkoutAccessIsInvalid(\EE_Checkout $checkout) {
39 39
 		if (
40
-			! ( $checkout->uts || $checkout->reg_url_link )
41
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
40
+			! ($checkout->uts || $checkout->reg_url_link)
41
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
42 42
             && \EE_Config::instance()->registration->track_invalid_checkout_access()
43 43
         ) {
44 44
 			/** @var \EE_Request $request */
45
-			$request = \EE_Registry::instance()->load_core( 'EE_Request' );
45
+			$request = \EE_Registry::instance()->load_core('EE_Request');
46 46
 			$ip_address = $request->ip_address();
47
-			$ee_bot_checkout = get_option( InvalidCheckoutAccess::OPTION_KEY );
48
-			if ( $ee_bot_checkout === false ) {
47
+			$ee_bot_checkout = get_option(InvalidCheckoutAccess::OPTION_KEY);
48
+			if ($ee_bot_checkout === false) {
49 49
 				$ee_bot_checkout = array();
50
-				add_option( InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false );
50
+				add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false);
51 51
 			}
52
-			if ( ! isset( $ee_bot_checkout[ $ip_address ] ) ) {
53
-				$ee_bot_checkout[ $ip_address ] = array();
52
+			if ( ! isset($ee_bot_checkout[$ip_address])) {
53
+				$ee_bot_checkout[$ip_address] = array();
54 54
 			}
55
-			$http_referer = isset( $_SERVER['HTTP_REFERER'] )
56
-				? esc_attr( $_SERVER['HTTP_REFERER'] )
55
+			$http_referer = isset($_SERVER['HTTP_REFERER'])
56
+				? esc_attr($_SERVER['HTTP_REFERER'])
57 57
 				: 0;
58
-			if ( ! isset( $ee_bot_checkout[ $ip_address ][ $http_referer ] ) ) {
59
-				$ee_bot_checkout[ $ip_address ][ $http_referer ] = 0;
58
+			if ( ! isset($ee_bot_checkout[$ip_address][$http_referer])) {
59
+				$ee_bot_checkout[$ip_address][$http_referer] = 0;
60 60
 			}
61
-			$ee_bot_checkout[ $ip_address ][ $http_referer ]++;
62
-			update_option( InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout );
61
+			$ee_bot_checkout[$ip_address][$http_referer]++;
62
+			update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout);
63 63
             if (WP_DEBUG) {
64 64
                 \EE_Error::add_error(
65 65
                     esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'),
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 				'layout_strategy' => new \EE_Admin_Two_Column_Layout(),
89 89
 				'subsections'     => array(
90 90
 					'invalid_checkout_access_hdr'   => new \EE_Form_Section_HTML(
91
-						\EEH_HTML::h2( esc_html__( 'Invalid Checkout Access', 'event_espresso' ) )
91
+						\EEH_HTML::h2(esc_html__('Invalid Checkout Access', 'event_espresso'))
92 92
 					),
93 93
 					'ee_bot_checkout_data'          => new \EE_Text_Area_Input(
94 94
 						array(
95
-							'html_label_text' => esc_html__( 'Invalid Checkout Data', 'event_espresso' ),
95
+							'html_label_text' => esc_html__('Invalid Checkout Data', 'event_espresso'),
96 96
 							'default'         => var_export(
97
-								get_option( InvalidCheckoutAccess::OPTION_KEY, array() ),
97
+								get_option(InvalidCheckoutAccess::OPTION_KEY, array()),
98 98
 								true
99 99
 							),
100 100
 							'required'        => false,
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					),
107 107
 					'track_invalid_checkout_access' => new \EE_Yes_No_Input(
108 108
 						array(
109
-							'html_label_text'         => __( 'Track Invalid Checkout Access?', 'event_espresso' ),
109
+							'html_label_text'         => __('Track Invalid Checkout Access?', 'event_espresso'),
110 110
 							'html_help_text'          => esc_html__(
111 111
 								'Controls whether or not invalid attempts to directly access the registration checkout page should be tracked. Setting this to "No" means that the above data will no longer be collected.',
112 112
 								'event_espresso'
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 					),
120 120
 					'delete_invalid_checkout_data'  => new \EE_Yes_No_Input(
121 121
 						array(
122
-							'html_label_text'         => __( 'Reset Invalid Checkout Data', 'event_espresso' ),
122
+							'html_label_text'         => __('Reset Invalid Checkout Data', 'event_espresso'),
123 123
 							'html_help_text'          => esc_html__(
124 124
 								'Setting this to "Yes" will delete all existing invalid checkout access data.',
125 125
 								'event_espresso'
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 * @param \EE_Registration_Config $EE_Registration_Config
142 142
 	 * @return \EE_Registration_Config
143 143
 	 */
144
-	public function processForm( \EE_Registration_Config $EE_Registration_Config ) {
144
+	public function processForm(\EE_Registration_Config $EE_Registration_Config) {
145 145
 		try {
146 146
 			$invalid_checkout_access_form = $this->getForm();
147 147
 			// if not displaying a form, then check for form submission
148
-			if ( $invalid_checkout_access_form->was_submitted() ) {
148
+			if ($invalid_checkout_access_form->was_submitted()) {
149 149
 				// capture form data
150 150
 				$invalid_checkout_access_form->receive_form_submission();
151 151
 				// validate form data
152
-				if ( $invalid_checkout_access_form->is_valid() ) {
152
+				if ($invalid_checkout_access_form->is_valid()) {
153 153
 					// grab validated data from form
154 154
 					$valid_data = $invalid_checkout_access_form->valid_data();
155 155
 					// ensure form inputs we want are set
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 							$valid_data['track_invalid_checkout_access']
164 164
 						);
165 165
 						// if deleting, then update option with empty array
166
-						if ( filter_var( $valid_data['delete_invalid_checkout_data'], FILTER_VALIDATE_BOOLEAN ) ) {
167
-							update_option( InvalidCheckoutAccess::OPTION_KEY, array() );
166
+						if (filter_var($valid_data['delete_invalid_checkout_data'], FILTER_VALIDATE_BOOLEAN)) {
167
+							update_option(InvalidCheckoutAccess::OPTION_KEY, array());
168 168
 						}
169 169
 					} else {
170 170
 						\EE_Error::add_error(
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 						);
179 179
 					}
180 180
 				} else {
181
-					if ( $invalid_checkout_access_form->submission_error_message() !== '' ) {
181
+					if ($invalid_checkout_access_form->submission_error_message() !== '') {
182 182
 						\EE_Error::add_error(
183 183
 							$invalid_checkout_access_form->submission_error_message(),
184 184
 							__FILE__,
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 					}
189 189
 				}
190 190
 			}
191
-		} catch ( \EE_Error $e ) {
191
+		} catch (\EE_Error $e) {
192 192
 			$e->get_error();
193 193
 		}
194 194
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 3 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1421,7 +1421,6 @@  discard block
 block discarded – undo
1421 1421
      * Makes sure the 3.1's image url is converted to an image attachment post to the 4.1 CPT event
1422 1422
      * and sets it as the featured image on the CPT event
1423 1423
      *
1424
-     * @param type                            $old_event
1425 1424
      * @param type                            $new_cpt_id
1426 1425
      * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1427 1426
      * @return boolean whether or not we had to do the big job of creating an image attachment
@@ -1483,7 +1482,7 @@  discard block
 block discarded – undo
1483 1482
      * we download it to our uploads directory so that it can be properly processed (eg, creates different sizes of
1484 1483
      * thumbnails)
1485 1484
      *
1486
-     * @param type                           $guid
1485
+     * @param string                           $guid
1487 1486
      * @param EE_Data_Migration_Script_Stage $migration_stage
1488 1487
      * @return int
1489 1488
      */
@@ -1571,7 +1570,7 @@  discard block
 block discarded – undo
1571 1570
      * Returns a mysql-formatted DATETIME in UTC time, given a $DATETIME_string
1572 1571
      * (and optionally a timezone; if none is given, the wp DEFAULT is used)
1573 1572
      *
1574
-     * @param EE_Data_Migration_Script_base $stage
1573
+     * @param EE_Data_Migration_Script_Stage $stage
1575 1574
      * @param array                         $row_of_data , the row from the DB (as an array) we're trying to find the
1576 1575
      *                                                   UTC time for
1577 1576
      * @param string                        $DATETIME_string
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 //unfortunately, this needs to be done upon INCLUSION of this file,
10 10
 //instead of construction, because it only gets constructed on first page load
11 11
 //(all other times it gets resurrected from a wordpress option)
12
-$stages = glob(EE_CORE . 'data_migration_scripts/4_1_0_stages/*');
12
+$stages = glob(EE_CORE.'data_migration_scripts/4_1_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 if ( ! empty($stages)) {
15 15
     foreach ($stages as $filepath) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     private function _checkin_table_exists()
88 88
     {
89 89
         global $wpdb;
90
-        $results = $wpdb->get_results("SHOW TABLES LIKE '" . $wpdb->prefix . "events_attendee_checkin" . "'");
90
+        $results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'");
91 91
         if ($results) {
92 92
             return true;
93 93
         } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 //			echo "no version string provided: $version_string";
108 108
             //no version string provided... this must be pre 4.1
109 109
             //because since 4.1 we're
110
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
110
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
111 111
         } else {
112 112
 //			echo "$version_string doesnt apply";
113 113
             return false;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function schema_changes_before_migration()
120 120
     {
121 121
         //relies on 4.1's EEH_Activation::create_table
122
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
122
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
123 123
         $table_name = 'esp_answer';
124 124
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
125 125
 					REG_ID INT UNSIGNED NOT NULL,
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
     public function insert_default_states()
504 504
     {
505 505
         global $wpdb;
506
-        $state_table = $wpdb->prefix . "esp_state";
506
+        $state_table = $wpdb->prefix."esp_state";
507 507
         if ($this->_get_table_analysis()->tableExists($state_table)) {
508
-            $SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
508
+            $SQL = "SELECT COUNT('STA_ID') FROM ".$state_table;
509 509
             $states = $wpdb->get_var($SQL);
510 510
             if ( ! $states) {
511
-                $SQL = "INSERT INTO " . $state_table . "
511
+                $SQL = "INSERT INTO ".$state_table."
512 512
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
513 513
 				(1, 'US', 'AK', 'Alaska', 1),
514 514
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
     public function insert_default_countries()
597 597
     {
598 598
         global $wpdb;
599
-        $country_table = $wpdb->prefix . "esp_country";
599
+        $country_table = $wpdb->prefix."esp_country";
600 600
         if ($this->_get_table_analysis()->tableExists($country_table)) {
601
-            $SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
601
+            $SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table;
602 602
             $countries = $wpdb->get_var($SQL);
603 603
             if ( ! $countries) {
604
-                $SQL = "INSERT INTO " . $country_table . "
604
+                $SQL = "INSERT INTO ".$country_table."
605 605
 				(CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active) VALUES
606 606
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607 607
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -846,17 +846,17 @@  discard block
 block discarded – undo
846 846
     public function insert_default_price_types()
847 847
     {
848 848
         global $wpdb;
849
-        $price_type_table = $wpdb->prefix . "esp_price_type";
849
+        $price_type_table = $wpdb->prefix."esp_price_type";
850 850
         if ($this->_get_table_analysis()->tableExists($price_type_table)) {
851
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
851
+            $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
852 852
             $price_types_exist = $wpdb->get_var($SQL);
853 853
             if ( ! $price_types_exist) {
854 854
                 $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
855
-							(1, '" . esc_html__('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
856
-							(2, '" . esc_html__('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
857
-							(3, '" . esc_html__('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
858
-							(4, '" . esc_html__('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
859
-							(5, '" . esc_html__('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
855
+							(1, '".esc_html__('Base Price', 'event_espresso')."', 1,  0, 0, 0),
856
+							(2, '" . esc_html__('Percent Discount', 'event_espresso')."', 2,  1, 20, 0),
857
+							(3, '" . esc_html__('Fixed Discount', 'event_espresso')."', 2,  0, 30, 0),
858
+							(4, '" . esc_html__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, 0),
859
+							(5, '" . esc_html__('Fixed Surcharge', 'event_espresso')."', 3,  0, 50, 0);";
860 860
                 $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
861 861
                 $wpdb->query($SQL);
862 862
             }
@@ -878,9 +878,9 @@  discard block
 block discarded – undo
878 878
     public function insert_default_prices()
879 879
     {
880 880
         global $wpdb;
881
-        $price_table = $wpdb->prefix . "esp_price";
881
+        $price_table = $wpdb->prefix."esp_price";
882 882
         if ($this->_get_table_analysis()->tableExists($price_table)) {
883
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
883
+            $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
884 884
             $prices_exist = $wpdb->get_var($SQL);
885 885
             if ( ! $prices_exist) {
886 886
                 $SQL = "INSERT INTO $price_table
@@ -904,9 +904,9 @@  discard block
 block discarded – undo
904 904
     public function insert_default_tickets()
905 905
     {
906 906
         global $wpdb;
907
-        $ticket_table = $wpdb->prefix . "esp_ticket";
907
+        $ticket_table = $wpdb->prefix."esp_ticket";
908 908
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
909
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
909
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
910 910
             $tickets_exist = $wpdb->get_var($SQL);
911 911
             if ( ! $tickets_exist) {
912 912
                 $SQL = "INSERT INTO $ticket_table
@@ -918,9 +918,9 @@  discard block
 block discarded – undo
918 918
                 $wpdb->query($SQL);
919 919
             }
920 920
         }
921
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
921
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
922 922
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
923
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
923
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
924 924
             $ticket_prc_exist = $wpdb->get_var($SQL);
925 925
             if ( ! $ticket_prc_exist) {
926 926
                 $SQL = "INSERT INTO $ticket_price_table
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
             throw new EE_Error(esc_html__("Could not get a country because country name is blank", "event_espresso"));
951 951
         }
952 952
         global $wpdb;
953
-        $country_table = $wpdb->prefix . "esp_country";
953
+        $country_table = $wpdb->prefix."esp_country";
954 954
         if (is_int($country_name)) {
955 955
             $country_name = $this->get_iso_from_3_1_country_id($country_name);
956 956
         }
@@ -978,21 +978,21 @@  discard block
 block discarded – undo
978 978
                     'CNT_active'      => true,
979 979
             );
980 980
             $data_types = array(
981
-                    '%s',//CNT_ISO
982
-                    '%s',//CNT_ISO3
983
-                    '%d',//RGN_ID
984
-                    '%s',//CNT_name
985
-                    '%s',//CNT_cur_code
986
-                    '%s',//CNT_cur_single
987
-                    '%s',//CNT_cur_plural
988
-                    '%s',//CNT_cur_sign
989
-                    '%d',//CNT_cur_sign_b4
990
-                    '%d',//CNT_cur_dec_plc
991
-                    '%s',//CNT_cur_dec_mrk
992
-                    '%s',//CNT_cur_thsnds
993
-                    '%s',//CNT_tel_code
994
-                    '%d',//CNT_is_EU
995
-                    '%d',//CNT_active
981
+                    '%s', //CNT_ISO
982
+                    '%s', //CNT_ISO3
983
+                    '%d', //RGN_ID
984
+                    '%s', //CNT_name
985
+                    '%s', //CNT_cur_code
986
+                    '%s', //CNT_cur_single
987
+                    '%s', //CNT_cur_plural
988
+                    '%s', //CNT_cur_sign
989
+                    '%d', //CNT_cur_sign_b4
990
+                    '%d', //CNT_cur_dec_plc
991
+                    '%s', //CNT_cur_dec_mrk
992
+                    '%s', //CNT_cur_thsnds
993
+                    '%s', //CNT_tel_code
994
+                    '%d', //CNT_is_EU
995
+                    '%d', //CNT_active
996 996
             );
997 997
             $success = $wpdb->insert($country_table,
998 998
                     $cols_n_values,
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
     private function _find_available_country_iso($num_letters = 2)
1018 1018
     {
1019 1019
         global $wpdb;
1020
-        $country_table = $wpdb->prefix . "esp_country";
1020
+        $country_table = $wpdb->prefix."esp_country";
1021 1021
         $attempts = 0;
1022 1022
         do {
1023 1023
             $current_iso = strtoupper(wp_generate_password($num_letters, false));
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
             //keep going until we find an available country code, or we arbitrarily
1029 1029
             //decide we've tried this enough. Somehow they have way too many countries
1030 1030
             //(probably because they're mis-using the EE3 country_id like a custom question)
1031
-        } while (intval($country_with_that_iso) && $attempts < 200);
1031
+        }while (intval($country_with_that_iso) && $attempts < 200);
1032 1032
         return $current_iso;
1033 1033
     }
1034 1034
 
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
             $country_iso = $this->get_default_country_iso();
1056 1056
         }
1057 1057
         global $wpdb;
1058
-        $state_table = $wpdb->prefix . "esp_state";
1058
+        $state_table = $wpdb->prefix."esp_state";
1059 1059
         $state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1060 1060
 			(STA_abbrev LIKE %s OR
1061 1061
 			STA_name LIKE %s) AND
@@ -1069,10 +1069,10 @@  discard block
 block discarded – undo
1069 1069
                     'STA_active' => true,
1070 1070
             );
1071 1071
             $data_types = array(
1072
-                    '%s',//CNT_ISO
1073
-                    '%s',//STA_abbrev
1074
-                    '%s',//STA_name
1075
-                    '%d',//STA_active
1072
+                    '%s', //CNT_ISO
1073
+                    '%s', //STA_abbrev
1074
+                    '%s', //STA_name
1075
+                    '%d', //STA_active
1076 1076
             );
1077 1077
             $success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1078 1078
             if ( ! $success) {
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
                         "event_espresso"), $guid));
1504 1504
                 return false;
1505 1505
             }
1506
-            $local_filepath = $wp_upload_dir['path'] . DS . basename($guid);
1506
+            $local_filepath = $wp_upload_dir['path'].DS.basename($guid);
1507 1507
             $savefile = fopen($local_filepath, 'w');
1508 1508
             fwrite($savefile, $contents);
1509 1509
             fclose($savefile);
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
         }
1527 1527
         // you must first include the image.php file
1528 1528
         // for the function wp_generate_attachment_metadata() to work
1529
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1529
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1530 1530
         $attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1531 1531
         if ( ! $attach_data) {
1532 1532
             $migration_stage->add_error(sprintf(esc_html__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.",
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
         );
1710 1710
         add_filter(
1711 1711
                 'FHEE__ee_migration_page__migration_options_template',
1712
-                array($this,'use_migration_options_from_ee3_template')
1712
+                array($this, 'use_migration_options_from_ee3_template')
1713 1713
         );
1714 1714
     }
1715 1715
 
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
      * @param $template_filepath
1764 1764
      * @return string
1765 1765
      */
1766
-    public function use_migration_options_from_ee3_template( $template_filepath ) {
1767
-        return EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee3.template.php';
1766
+    public function use_migration_options_from_ee3_template($template_filepath) {
1767
+        return EE_MAINTENANCE_TEMPLATE_PATH.'migration_options_from_ee3.template.php';
1768 1768
     }
1769 1769
 }
Please login to merge, or discard this patch.
Indentation   +1137 added lines, -1137 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 $stages = glob(EE_CORE . 'data_migration_scripts/4_1_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 if ( ! empty($stages)) {
15
-    foreach ($stages as $filepath) {
16
-        $matches = array();
17
-        preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18
-        $class_to_filepath[$matches[1]] = $filepath;
19
-    }
15
+	foreach ($stages as $filepath) {
16
+		$matches = array();
17
+		preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18
+		$class_to_filepath[$matches[1]] = $filepath;
19
+	}
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages', $class_to_filepath);
@@ -44,91 +44,91 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 
47
-    /**
48
-     * EE_DMS_Core_4_1_0 constructor.
49
-     *
50
-     * @param TableManager  $table_manager
51
-     * @param TableAnalysis $table_analysis
52
-     */
53
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
54
-    {
55
-        $this->_pretty_name = esc_html__("Data Migration from Event Espresso 3 to Event Espresso 4.1.0", "event_espresso");
56
-        $this->_priority = 10;
57
-        $this->_migration_stages = array(
58
-                new EE_DMS_4_1_0_org_options(),
59
-                new EE_DMS_4_1_0_shortcodes(),
60
-                new EE_DMS_4_1_0_gateways(),
61
-                new EE_DMS_4_1_0_events(),
62
-                new EE_DMS_4_1_0_prices(),
63
-                new EE_DMS_4_1_0_category_details(),
64
-                new EE_DMS_4_1_0_event_category(),
65
-                new EE_DMS_4_1_0_venues(),
66
-                new EE_DMS_4_1_0_event_venue(),
67
-                new EE_DMS_4_1_0_question_groups(),
68
-                new EE_DMS_4_1_0_questions(),
69
-                new EE_DMS_4_1_0_question_group_question(),
70
-                new EE_DMS_4_1_0_event_question_group(),
71
-                new EE_DMS_4_1_0_attendees(),
72
-                new EE_DMS_4_1_0_line_items(),
73
-                new EE_DMS_4_1_0_answers(),
74
-                new EE_DMS_4_1_0_checkins(),
75
-        );
76
-        parent::__construct($table_manager, $table_analysis);
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * Checks if this 3.1 Check-in table exists. If it doesn't we can't migrate Check-ins
83
-     *
84
-     * @global wpdb $wpdb
85
-     * @return boolean
86
-     */
87
-    private function _checkin_table_exists()
88
-    {
89
-        global $wpdb;
90
-        $results = $wpdb->get_results("SHOW TABLES LIKE '" . $wpdb->prefix . "events_attendee_checkin" . "'");
91
-        if ($results) {
92
-            return true;
93
-        } else {
94
-            return false;
95
-        }
96
-    }
97
-
98
-
99
-
100
-    public function can_migrate_from_version($version_array)
101
-    {
102
-        $version_string = $version_array['Core'];
103
-        if (version_compare($version_string, '4.0.0', '<=') && version_compare($version_string, '3.1.26', '>=')) {
47
+	/**
48
+	 * EE_DMS_Core_4_1_0 constructor.
49
+	 *
50
+	 * @param TableManager  $table_manager
51
+	 * @param TableAnalysis $table_analysis
52
+	 */
53
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
54
+	{
55
+		$this->_pretty_name = esc_html__("Data Migration from Event Espresso 3 to Event Espresso 4.1.0", "event_espresso");
56
+		$this->_priority = 10;
57
+		$this->_migration_stages = array(
58
+				new EE_DMS_4_1_0_org_options(),
59
+				new EE_DMS_4_1_0_shortcodes(),
60
+				new EE_DMS_4_1_0_gateways(),
61
+				new EE_DMS_4_1_0_events(),
62
+				new EE_DMS_4_1_0_prices(),
63
+				new EE_DMS_4_1_0_category_details(),
64
+				new EE_DMS_4_1_0_event_category(),
65
+				new EE_DMS_4_1_0_venues(),
66
+				new EE_DMS_4_1_0_event_venue(),
67
+				new EE_DMS_4_1_0_question_groups(),
68
+				new EE_DMS_4_1_0_questions(),
69
+				new EE_DMS_4_1_0_question_group_question(),
70
+				new EE_DMS_4_1_0_event_question_group(),
71
+				new EE_DMS_4_1_0_attendees(),
72
+				new EE_DMS_4_1_0_line_items(),
73
+				new EE_DMS_4_1_0_answers(),
74
+				new EE_DMS_4_1_0_checkins(),
75
+		);
76
+		parent::__construct($table_manager, $table_analysis);
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * Checks if this 3.1 Check-in table exists. If it doesn't we can't migrate Check-ins
83
+	 *
84
+	 * @global wpdb $wpdb
85
+	 * @return boolean
86
+	 */
87
+	private function _checkin_table_exists()
88
+	{
89
+		global $wpdb;
90
+		$results = $wpdb->get_results("SHOW TABLES LIKE '" . $wpdb->prefix . "events_attendee_checkin" . "'");
91
+		if ($results) {
92
+			return true;
93
+		} else {
94
+			return false;
95
+		}
96
+	}
97
+
98
+
99
+
100
+	public function can_migrate_from_version($version_array)
101
+	{
102
+		$version_string = $version_array['Core'];
103
+		if (version_compare($version_string, '4.0.0', '<=') && version_compare($version_string, '3.1.26', '>=')) {
104 104
 //			echo "$version_string can be migrated fro";
105
-            return true;
106
-        } elseif ( ! $version_string) {
105
+			return true;
106
+		} elseif ( ! $version_string) {
107 107
 //			echo "no version string provided: $version_string";
108
-            //no version string provided... this must be pre 4.1
109
-            //because since 4.1 we're
110
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
111
-        } else {
108
+			//no version string provided... this must be pre 4.1
109
+			//because since 4.1 we're
110
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
111
+		} else {
112 112
 //			echo "$version_string doesnt apply";
113
-            return false;
114
-        }
115
-    }
113
+			return false;
114
+		}
115
+	}
116 116
 
117 117
 
118 118
 
119
-    public function schema_changes_before_migration()
120
-    {
121
-        //relies on 4.1's EEH_Activation::create_table
122
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
123
-        $table_name = 'esp_answer';
124
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
119
+	public function schema_changes_before_migration()
120
+	{
121
+		//relies on 4.1's EEH_Activation::create_table
122
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
123
+		$table_name = 'esp_answer';
124
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
125 125
 					REG_ID INT UNSIGNED NOT NULL,
126 126
 					QST_ID INT UNSIGNED NOT NULL,
127 127
 					ANS_value TEXT NOT NULL,
128 128
 					PRIMARY KEY  (ANS_ID)";
129
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
130
-        $table_name = 'esp_attendee_meta';
131
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
129
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
130
+		$table_name = 'esp_attendee_meta';
131
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
132 132
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
133 133
 						ATT_fname VARCHAR(45) NOT NULL,
134 134
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 								KEY ATT_fname (ATT_fname),
145 145
 								KEY ATT_lname (ATT_lname),
146 146
 								KEY ATT_email (ATT_email)";
147
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
148
-        $table_name = 'esp_country';
149
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
147
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
148
+		$table_name = 'esp_country';
149
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
150 150
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
151 151
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
152 152
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
163 163
 					  CNT_active TINYINT(1) DEFAULT '0',
164 164
 					  PRIMARY KEY  (CNT_ISO)";
165
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
166
-        $table_name = 'esp_datetime';
167
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
165
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
166
+		$table_name = 'esp_datetime';
167
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
168 168
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
169 169
 				  DTT_EVT_start DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
170 170
 				  DTT_EVT_end DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 						PRIMARY KEY  (DTT_ID),
178 178
 						KEY EVT_ID (EVT_ID),
179 179
 						KEY DTT_is_primary (DTT_is_primary)";
180
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
181
-        $table_name = 'esp_event_meta';
182
-        $sql = "
180
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
181
+		$table_name = 'esp_event_meta';
182
+		$sql = "
183 183
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
184 184
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
185 185
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -194,31 +194,31 @@  discard block
 block discarded – undo
194 194
 			EVT_external_URL VARCHAR(200) NULL,
195 195
 			EVT_donations TINYINT(1) NULL,
196 196
 			PRIMARY KEY  (EVTM_ID)";
197
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
198
-        $table_name = 'esp_event_question_group';
199
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
197
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
198
+		$table_name = 'esp_event_question_group';
199
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
200 200
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
201 201
 					QSG_ID INT UNSIGNED NOT NULL,
202 202
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
203 203
 					PRIMARY KEY  (EQG_ID)";
204
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
205
-        $table_name = 'esp_event_venue';
206
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
204
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
205
+		$table_name = 'esp_event_venue';
206
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
207 207
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
208 208
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
209 209
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
210 210
 				PRIMARY KEY  (EVV_ID)";
211
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212
-        $table_name = 'esp_extra_meta';
213
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
211
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212
+		$table_name = 'esp_extra_meta';
213
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
214 214
 				OBJ_ID INT(11) DEFAULT NULL,
215 215
 				EXM_type VARCHAR(45) DEFAULT NULL,
216 216
 				EXM_key VARCHAR(45) DEFAULT NULL,
217 217
 				EXM_value TEXT,
218 218
 				PRIMARY KEY  (EXM_ID)";
219
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
220
-        $table_name = 'esp_line_item';
221
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
219
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
220
+		$table_name = 'esp_line_item';
221
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
222 222
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
223 223
 				TXN_ID INT(11) DEFAULT NULL,
224 224
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 				OBJ_ID INT(11) DEFAULT NULL,
235 235
 				OBJ_type VARCHAR(45)DEFAULT NULL,
236 236
 				PRIMARY KEY  (LIN_ID)";
237
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
238
-        $table_name = 'esp_message_template';
239
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
237
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
238
+		$table_name = 'esp_message_template';
239
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
240 240
 					GRP_ID INT(10) UNSIGNED NOT NULL,
241 241
 					MTP_context VARCHAR(50) NOT NULL,
242 242
 					MTP_template_field VARCHAR(30) NOT NULL,
243 243
 					MTP_content TEXT NOT NULL,
244 244
 					PRIMARY KEY  (MTP_ID),
245 245
 					KEY GRP_ID (GRP_ID)";
246
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
247
-        $table_name = 'esp_message_template_group';
248
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
246
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
247
+		$table_name = 'esp_message_template_group';
248
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
249 249
 					EVT_ID BIGINT(20) UNSIGNED DEFAULT NULL,
250 250
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
251 251
 					MTP_messenger VARCHAR(30) NOT NULL,
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 					PRIMARY KEY  (GRP_ID),
258 258
 					KEY EVT_ID (EVT_ID),
259 259
 					KEY MTP_user_id (MTP_user_id)";
260
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
261
-        $table_name = 'esp_payment';
262
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
260
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
261
+		$table_name = 'esp_payment';
262
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
263 263
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
264 264
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
265 265
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 					PRIMARY KEY  (PAY_ID),
276 276
 					KEY TXN_ID (TXN_ID),
277 277
 					KEY PAY_timestamp (PAY_timestamp)";
278
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
279
-        $table_name = "esp_ticket";
280
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
278
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
279
+		$table_name = "esp_ticket";
280
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
281 281
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
282 282
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
283 283
 					  TKT_description TEXT NOT NULL,
@@ -296,28 +296,28 @@  discard block
 block discarded – undo
296 296
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
297 297
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
298 298
 					  PRIMARY KEY  (TKT_ID)";
299
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
300
-        $table_name = "esp_ticket_price";
301
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
299
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
300
+		$table_name = "esp_ticket_price";
301
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
302 302
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
303 303
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
304 304
 					  PRIMARY KEY  (TKP_ID)";
305
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
306
-        $table_name = "esp_datetime_ticket";
307
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
305
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
306
+		$table_name = "esp_datetime_ticket";
307
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
308 308
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
309 309
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
310 310
 					  PRIMARY KEY  (DTK_ID)";
311
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
312
-        $table_name = "esp_ticket_template";
313
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
311
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
312
+		$table_name = "esp_ticket_template";
313
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
314 314
 					  TTM_name VARCHAR(45) NOT NULL,
315 315
 					  TTM_description TEXT,
316 316
 					  TTM_file VARCHAR(45),
317 317
 					  PRIMARY KEY  (TTM_ID)";
318
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
319
-        $table_name = "esp_price";
320
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
319
+		$table_name = "esp_price";
320
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
321 321
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
322 322
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
323 323
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
329 329
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
330 330
 					  PRIMARY KEY  (PRC_ID)";
331
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
332
-        $table_name = "esp_price_type";
333
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
331
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
332
+		$table_name = "esp_price_type";
333
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
334 334
 				  PRT_name VARCHAR(45) NOT NULL,
335 335
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
336 336
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
339 339
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
340 340
 				  PRIMARY KEY  (PRT_ID)";
341
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
342
-        $table_name = 'esp_question';
343
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_question';
343
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
344 344
 					QST_display_text TEXT NOT NULL,
345 345
 					QST_admin_label VARCHAR(255) NOT NULL,
346 346
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 					QST_wp_user BIGINT UNSIGNED NULL,
353 353
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
354 354
 					PRIMARY KEY  (QST_ID)';
355
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
356
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
357
-        $table_name = 'esp_question_group';
358
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
355
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
356
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
357
+		$table_name = 'esp_question_group';
358
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
359 359
 					QSG_name VARCHAR(255) NOT NULL,
360 360
 					QSG_identifier VARCHAR(100) NOT NULL,
361 361
 					QSG_desc TEXT NULL,
@@ -366,23 +366,23 @@  discard block
 block discarded – undo
366 366
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
367 367
 					PRIMARY KEY  (QSG_ID),
368 368
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
369
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
370
-        $table_name = 'esp_question_group_question';
371
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
369
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
370
+		$table_name = 'esp_question_group_question';
371
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
372 372
 					QSG_ID INT UNSIGNED NOT NULL,
373 373
 					QST_ID INT UNSIGNED NOT NULL,
374 374
 					PRIMARY KEY  (QGQ_ID) ";
375
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
376
-        $table_name = 'esp_question_option';
377
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
375
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
376
+		$table_name = 'esp_question_option';
377
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
378 378
 					QSO_value VARCHAR(255) NOT NULL,
379 379
 					QSO_desc TEXT NOT NULL,
380 380
 					QST_ID INT UNSIGNED NOT NULL,
381 381
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
382 382
 					PRIMARY KEY  (QSO_ID)";
383
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
384
-        $table_name = 'esp_registration';
385
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
383
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
384
+		$table_name = 'esp_registration';
385
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
386 386
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
387 387
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
388 388
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -405,25 +405,25 @@  discard block
 block discarded – undo
405 405
 					  KEY STS_ID (STS_ID),
406 406
 					  KEY REG_url_link (REG_url_link),
407 407
 					  KEY REG_code (REG_code)";
408
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
409
-        $table_name = 'esp_checkin';
410
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
408
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
409
+		$table_name = 'esp_checkin';
410
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
411 411
 					REG_ID INT(10) UNSIGNED NOT NULL,
412 412
 					DTT_ID INT(10) UNSIGNED NOT NULL,
413 413
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
414 414
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
415 415
 					PRIMARY KEY  (CHK_ID)";
416
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
417
-        $table_name = 'esp_state';
418
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
416
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
417
+		$table_name = 'esp_state';
418
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
419 419
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
420 420
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
421 421
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
422 422
 					  STA_active TINYINT(1) DEFAULT '1',
423 423
 					  PRIMARY KEY  (STA_ID)";
424
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
425
-        $table_name = 'esp_status';
426
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
424
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
425
+		$table_name = 'esp_status';
426
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
427 427
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
428 428
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
429 429
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
432 432
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
433 433
 					  KEY STS_type (STS_type)";
434
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
-        $table_name = 'esp_transaction';
436
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
434
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
+		$table_name = 'esp_transaction';
436
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
437 437
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
438 438
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
439 439
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 					  PRIMARY KEY  (TXN_ID),
444 444
 					  KEY TXN_timestamp (TXN_timestamp),
445 445
 					  KEY STS_ID (STS_ID)";
446
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
447
-        $table_name = 'esp_venue_meta';
448
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
446
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
447
+		$table_name = 'esp_venue_meta';
448
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
449 449
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
450 450
 			VNU_address VARCHAR(255) DEFAULT NULL,
451 451
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -463,52 +463,52 @@  discard block
 block discarded – undo
463 463
 			PRIMARY KEY  (VNUM_ID),
464 464
 			KEY STA_ID (STA_ID),
465 465
 			KEY CNT_ISO (CNT_ISO)";
466
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
467
-        //setting up the DEFAULT stats and countries is also essential for the data migrations to run
468
-        //(because many need to convert old string states to foreign keys into the states table)
469
-        $this->insert_default_states();
470
-        $this->insert_default_countries();
471
-        //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
472
-        $this->insert_default_price_types();
473
-        $this->insert_default_prices();
474
-        $this->insert_default_tickets();
475
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
476
-        EE_Config::instance()->update_espresso_config(false, true);
477
-        return true;
478
-    }
479
-
480
-
481
-
482
-    /**
483
-     * Yes we could have cleaned up the ee3 tables here. But just in case someone
484
-     * didn't backup their DB, and decides they want ot keep using EE3, we'll
485
-     * leave them for now. Mayeb remove them in 4.5 or something.
486
-     *
487
-     * @return boolean
488
-     */
489
-    public function schema_changes_after_migration()
490
-    {
491
-        return true;
492
-    }
493
-
494
-
495
-
496
-    /**
497
-     * insert_default_states
498
-     *
499
-     * @access public
500
-     * @static
501
-     * @return void
502
-     */
503
-    public function insert_default_states()
504
-    {
505
-        global $wpdb;
506
-        $state_table = $wpdb->prefix . "esp_state";
507
-        if ($this->_get_table_analysis()->tableExists($state_table)) {
508
-            $SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
509
-            $states = $wpdb->get_var($SQL);
510
-            if ( ! $states) {
511
-                $SQL = "INSERT INTO " . $state_table . "
466
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
467
+		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
468
+		//(because many need to convert old string states to foreign keys into the states table)
469
+		$this->insert_default_states();
470
+		$this->insert_default_countries();
471
+		//setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
472
+		$this->insert_default_price_types();
473
+		$this->insert_default_prices();
474
+		$this->insert_default_tickets();
475
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
476
+		EE_Config::instance()->update_espresso_config(false, true);
477
+		return true;
478
+	}
479
+
480
+
481
+
482
+	/**
483
+	 * Yes we could have cleaned up the ee3 tables here. But just in case someone
484
+	 * didn't backup their DB, and decides they want ot keep using EE3, we'll
485
+	 * leave them for now. Mayeb remove them in 4.5 or something.
486
+	 *
487
+	 * @return boolean
488
+	 */
489
+	public function schema_changes_after_migration()
490
+	{
491
+		return true;
492
+	}
493
+
494
+
495
+
496
+	/**
497
+	 * insert_default_states
498
+	 *
499
+	 * @access public
500
+	 * @static
501
+	 * @return void
502
+	 */
503
+	public function insert_default_states()
504
+	{
505
+		global $wpdb;
506
+		$state_table = $wpdb->prefix . "esp_state";
507
+		if ($this->_get_table_analysis()->tableExists($state_table)) {
508
+			$SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
509
+			$states = $wpdb->get_var($SQL);
510
+			if ( ! $states) {
511
+				$SQL = "INSERT INTO " . $state_table . "
512 512
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
513 513
 				(1, 'US', 'AK', 'Alaska', 1),
514 514
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -579,29 +579,29 @@  discard block
 block discarded – undo
579 579
 				(67, 'CA', 'PE', 'Prince Edward Island', 1),
580 580
 				(68, 'CA', 'QC', 'Quebec', 1),
581 581
 				(69, 'CA', 'SK', 'Saskatchewan', 1);";
582
-                $wpdb->query($SQL);
583
-            }
584
-        }
585
-    }
586
-
587
-
588
-
589
-    /**
590
-     * insert_default_countries
591
-     *
592
-     * @access public
593
-     * @static
594
-     * @return void
595
-     */
596
-    public function insert_default_countries()
597
-    {
598
-        global $wpdb;
599
-        $country_table = $wpdb->prefix . "esp_country";
600
-        if ($this->_get_table_analysis()->tableExists($country_table)) {
601
-            $SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
602
-            $countries = $wpdb->get_var($SQL);
603
-            if ( ! $countries) {
604
-                $SQL = "INSERT INTO " . $country_table . "
582
+				$wpdb->query($SQL);
583
+			}
584
+		}
585
+	}
586
+
587
+
588
+
589
+	/**
590
+	 * insert_default_countries
591
+	 *
592
+	 * @access public
593
+	 * @static
594
+	 * @return void
595
+	 */
596
+	public function insert_default_countries()
597
+	{
598
+		global $wpdb;
599
+		$country_table = $wpdb->prefix . "esp_country";
600
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
601
+			$SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
602
+			$countries = $wpdb->get_var($SQL);
603
+			if ( ! $countries) {
604
+				$SQL = "INSERT INTO " . $country_table . "
605 605
 				(CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active) VALUES
606 606
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607 607
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -829,941 +829,941 @@  discard block
 block discarded – undo
829 829
 				('ZA', 'ZAF', 0, 'South Africa', 'ZAR', 'Rand', 'Rands', 'R', 1, 2, '+27', 0, 0),
830 830
 				('ZM', 'ZMB', 0, 'Zambia', 'ZMK', 'Kwacha', 'Kwachas', '', 1, 2, '+260', 0, 0),
831 831
 				('ZW', 'ZWE', 0, 'Zimbabwe', 'ZWD', 'Dollar', 'Dollars', 'Z$', 1, 2, '+263', 0, 0);";
832
-                $wpdb->query($SQL);
833
-            }
834
-        }
835
-    }
836
-
837
-
838
-
839
-    /**
840
-     * insert_default_price_types
841
-     *
842
-     * @access public
843
-     * @static
844
-     * @return void
845
-     */
846
-    public function insert_default_price_types()
847
-    {
848
-        global $wpdb;
849
-        $price_type_table = $wpdb->prefix . "esp_price_type";
850
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
851
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
852
-            $price_types_exist = $wpdb->get_var($SQL);
853
-            if ( ! $price_types_exist) {
854
-                $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
832
+				$wpdb->query($SQL);
833
+			}
834
+		}
835
+	}
836
+
837
+
838
+
839
+	/**
840
+	 * insert_default_price_types
841
+	 *
842
+	 * @access public
843
+	 * @static
844
+	 * @return void
845
+	 */
846
+	public function insert_default_price_types()
847
+	{
848
+		global $wpdb;
849
+		$price_type_table = $wpdb->prefix . "esp_price_type";
850
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
851
+			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
852
+			$price_types_exist = $wpdb->get_var($SQL);
853
+			if ( ! $price_types_exist) {
854
+				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
855 855
 							(1, '" . esc_html__('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
856 856
 							(2, '" . esc_html__('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
857 857
 							(3, '" . esc_html__('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
858 858
 							(4, '" . esc_html__('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
859 859
 							(5, '" . esc_html__('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
860
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
861
-                $wpdb->query($SQL);
862
-            }
863
-        }
864
-    }
865
-
866
-
867
-
868
-    /**
869
-     * insert_default_prices. We assume we're upgrading to regular here.
870
-     * If we're INSTALLING 4.1 CAF, then we add a few extra DEFAULT prices
871
-     * when EEH_Activaion's initialize_db_content is called via  ahook in
872
-     * EE_BRewing_regular
873
-     *
874
-     * @access public
875
-     * @static
876
-     * @return void
877
-     */
878
-    public function insert_default_prices()
879
-    {
880
-        global $wpdb;
881
-        $price_table = $wpdb->prefix . "esp_price";
882
-        if ($this->_get_table_analysis()->tableExists($price_table)) {
883
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
884
-            $prices_exist = $wpdb->get_var($SQL);
885
-            if ( ! $prices_exist) {
886
-                $SQL = "INSERT INTO $price_table
860
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
861
+				$wpdb->query($SQL);
862
+			}
863
+		}
864
+	}
865
+
866
+
867
+
868
+	/**
869
+	 * insert_default_prices. We assume we're upgrading to regular here.
870
+	 * If we're INSTALLING 4.1 CAF, then we add a few extra DEFAULT prices
871
+	 * when EEH_Activaion's initialize_db_content is called via  ahook in
872
+	 * EE_BRewing_regular
873
+	 *
874
+	 * @access public
875
+	 * @static
876
+	 * @return void
877
+	 */
878
+	public function insert_default_prices()
879
+	{
880
+		global $wpdb;
881
+		$price_table = $wpdb->prefix . "esp_price";
882
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
883
+			$SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
884
+			$prices_exist = $wpdb->get_var($SQL);
885
+			if ( ! $prices_exist) {
886
+				$SQL = "INSERT INTO $price_table
887 887
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES
888 888
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);";
889
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
890
-                $wpdb->query($SQL);
891
-            }
892
-        }
893
-    }
894
-
895
-
896
-
897
-    /**
898
-     * insert DEFAULT ticket
899
-     *
900
-     * @access public
901
-     * @static
902
-     * @return void
903
-     */
904
-    public function insert_default_tickets()
905
-    {
906
-        global $wpdb;
907
-        $ticket_table = $wpdb->prefix . "esp_ticket";
908
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
909
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
910
-            $tickets_exist = $wpdb->get_var($SQL);
911
-            if ( ! $tickets_exist) {
912
-                $SQL = "INSERT INTO $ticket_table
889
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
890
+				$wpdb->query($SQL);
891
+			}
892
+		}
893
+	}
894
+
895
+
896
+
897
+	/**
898
+	 * insert DEFAULT ticket
899
+	 *
900
+	 * @access public
901
+	 * @static
902
+	 * @return void
903
+	 */
904
+	public function insert_default_tickets()
905
+	{
906
+		global $wpdb;
907
+		$ticket_table = $wpdb->prefix . "esp_ticket";
908
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
909
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
910
+			$tickets_exist = $wpdb->get_var($SQL);
911
+			if ( ! $tickets_exist) {
912
+				$SQL = "INSERT INTO $ticket_table
913 913
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
914 914
 					( 1, 0, '"
915
-                       . esc_html__("Free Ticket", "event_espresso")
916
-                       . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
917
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
918
-                $wpdb->query($SQL);
919
-            }
920
-        }
921
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
922
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
923
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
924
-            $ticket_prc_exist = $wpdb->get_var($SQL);
925
-            if ( ! $ticket_prc_exist) {
926
-                $SQL = "INSERT INTO $ticket_price_table
915
+					   . esc_html__("Free Ticket", "event_espresso")
916
+					   . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
917
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
918
+				$wpdb->query($SQL);
919
+			}
920
+		}
921
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
922
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
923
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
924
+			$ticket_prc_exist = $wpdb->get_var($SQL);
925
+			if ( ! $ticket_prc_exist) {
926
+				$SQL = "INSERT INTO $ticket_price_table
927 927
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
928 928
 				( 1, 1, 1 )
929 929
 				";
930
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
931
-                $wpdb->query($SQL);
932
-            }
933
-        }
934
-    }
935
-
936
-
937
-
938
-    /**
939
-     * Gets a country entry as an array, or creates one if none is found. Much like EEM_Country::instance()->get_one(),
940
-     * but is independent of outside code which can change in future versions of EE. Also, $country_name CAN be a 3.1
941
-     * country ID (int), a 2-letter ISO, 3-letter ISO, or name
942
-     *
943
-     * @global type  $wpdb
944
-     * @param string $country_name
945
-     * @return array where keys are columns, values are column values
946
-     */
947
-    public function get_or_create_country($country_name)
948
-    {
949
-        if ( ! $country_name) {
950
-            throw new EE_Error(esc_html__("Could not get a country because country name is blank", "event_espresso"));
951
-        }
952
-        global $wpdb;
953
-        $country_table = $wpdb->prefix . "esp_country";
954
-        if (is_int($country_name)) {
955
-            $country_name = $this->get_iso_from_3_1_country_id($country_name);
956
-        }
957
-        $country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
930
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
931
+				$wpdb->query($SQL);
932
+			}
933
+		}
934
+	}
935
+
936
+
937
+
938
+	/**
939
+	 * Gets a country entry as an array, or creates one if none is found. Much like EEM_Country::instance()->get_one(),
940
+	 * but is independent of outside code which can change in future versions of EE. Also, $country_name CAN be a 3.1
941
+	 * country ID (int), a 2-letter ISO, 3-letter ISO, or name
942
+	 *
943
+	 * @global type  $wpdb
944
+	 * @param string $country_name
945
+	 * @return array where keys are columns, values are column values
946
+	 */
947
+	public function get_or_create_country($country_name)
948
+	{
949
+		if ( ! $country_name) {
950
+			throw new EE_Error(esc_html__("Could not get a country because country name is blank", "event_espresso"));
951
+		}
952
+		global $wpdb;
953
+		$country_table = $wpdb->prefix . "esp_country";
954
+		if (is_int($country_name)) {
955
+			$country_name = $this->get_iso_from_3_1_country_id($country_name);
956
+		}
957
+		$country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
958 958
 			CNT_ISO LIKE %s OR
959 959
 			CNT_ISO3 LIKE %s OR
960 960
 			CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A);
961
-        if ( ! $country) {
962
-            //insert a new one then
963
-            $cols_n_values = array(
964
-                    'CNT_ISO'         => $this->_find_available_country_iso(2),
965
-                    'CNT_ISO3'        => $this->_find_available_country_iso(3),
966
-                    'RGN_ID'          => 0,
967
-                    'CNT_name'        => $country_name,
968
-                    'CNT_cur_code'    => 'USD',
969
-                    'CNT_cur_single'  => 'Dollar',
970
-                    'CNT_cur_plural'  => 'Dollars',
971
-                    'CNT_cur_sign'    => '&#36;',
972
-                    'CNT_cur_sign_b4' => true,
973
-                    'CNT_cur_dec_plc' => 2,
974
-                    'CNT_cur_dec_mrk' => '.',
975
-                    'CNT_cur_thsnds'  => ',',
976
-                    'CNT_tel_code'    => '+1',
977
-                    'CNT_is_EU'       => false,
978
-                    'CNT_active'      => true,
979
-            );
980
-            $data_types = array(
981
-                    '%s',//CNT_ISO
982
-                    '%s',//CNT_ISO3
983
-                    '%d',//RGN_ID
984
-                    '%s',//CNT_name
985
-                    '%s',//CNT_cur_code
986
-                    '%s',//CNT_cur_single
987
-                    '%s',//CNT_cur_plural
988
-                    '%s',//CNT_cur_sign
989
-                    '%d',//CNT_cur_sign_b4
990
-                    '%d',//CNT_cur_dec_plc
991
-                    '%s',//CNT_cur_dec_mrk
992
-                    '%s',//CNT_cur_thsnds
993
-                    '%s',//CNT_tel_code
994
-                    '%d',//CNT_is_EU
995
-                    '%d',//CNT_active
996
-            );
997
-            $success = $wpdb->insert($country_table,
998
-                    $cols_n_values,
999
-                    $data_types);
1000
-            if ( ! $success) {
1001
-                throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1002
-                        array('country_id' => $country_name), $country_table, $cols_n_values, $data_types));
1003
-            }
1004
-            $country = $cols_n_values;
1005
-        }
1006
-        return $country;
1007
-    }
1008
-
1009
-
1010
-
1011
-    /**
1012
-     * finds a country iso which hasnt been used yet
1013
-     *
1014
-     * @global type $wpdb
1015
-     * @return string
1016
-     */
1017
-    private function _find_available_country_iso($num_letters = 2)
1018
-    {
1019
-        global $wpdb;
1020
-        $country_table = $wpdb->prefix . "esp_country";
1021
-        $attempts = 0;
1022
-        do {
1023
-            $current_iso = strtoupper(wp_generate_password($num_letters, false));
1024
-            $country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM "
1025
-                                                                   . $country_table
1026
-                                                                   . " WHERE CNT_ISO=%s", $current_iso));
1027
-            $attempts++;
1028
-            //keep going until we find an available country code, or we arbitrarily
1029
-            //decide we've tried this enough. Somehow they have way too many countries
1030
-            //(probably because they're mis-using the EE3 country_id like a custom question)
1031
-        } while (intval($country_with_that_iso) && $attempts < 200);
1032
-        return $current_iso;
1033
-    }
1034
-
1035
-
1036
-
1037
-    /**
1038
-     * Gets a state entry as an array, or creates one if none is found. Much like EEM_State::instance()->get_one(), but
1039
-     * is independent of outside code which can change in future versions of EE
1040
-     *
1041
-     * @global type  $wpdb
1042
-     * @param string $state_name
1043
-     * @return array where keys are columns, values are column values
1044
-     */
1045
-    public function get_or_create_state($state_name, $country_name = '')
1046
-    {
1047
-        if ( ! $state_name) {
1048
-            throw new EE_Error(esc_html__("Could not get-or-create state because no state name was provided",
1049
-                    "event_espresso"));
1050
-        }
1051
-        try {
1052
-            $country = $this->get_or_create_country($country_name);
1053
-            $country_iso = $country['CNT_ISO'];
1054
-        } catch (EE_Error $e) {
1055
-            $country_iso = $this->get_default_country_iso();
1056
-        }
1057
-        global $wpdb;
1058
-        $state_table = $wpdb->prefix . "esp_state";
1059
-        $state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
961
+		if ( ! $country) {
962
+			//insert a new one then
963
+			$cols_n_values = array(
964
+					'CNT_ISO'         => $this->_find_available_country_iso(2),
965
+					'CNT_ISO3'        => $this->_find_available_country_iso(3),
966
+					'RGN_ID'          => 0,
967
+					'CNT_name'        => $country_name,
968
+					'CNT_cur_code'    => 'USD',
969
+					'CNT_cur_single'  => 'Dollar',
970
+					'CNT_cur_plural'  => 'Dollars',
971
+					'CNT_cur_sign'    => '&#36;',
972
+					'CNT_cur_sign_b4' => true,
973
+					'CNT_cur_dec_plc' => 2,
974
+					'CNT_cur_dec_mrk' => '.',
975
+					'CNT_cur_thsnds'  => ',',
976
+					'CNT_tel_code'    => '+1',
977
+					'CNT_is_EU'       => false,
978
+					'CNT_active'      => true,
979
+			);
980
+			$data_types = array(
981
+					'%s',//CNT_ISO
982
+					'%s',//CNT_ISO3
983
+					'%d',//RGN_ID
984
+					'%s',//CNT_name
985
+					'%s',//CNT_cur_code
986
+					'%s',//CNT_cur_single
987
+					'%s',//CNT_cur_plural
988
+					'%s',//CNT_cur_sign
989
+					'%d',//CNT_cur_sign_b4
990
+					'%d',//CNT_cur_dec_plc
991
+					'%s',//CNT_cur_dec_mrk
992
+					'%s',//CNT_cur_thsnds
993
+					'%s',//CNT_tel_code
994
+					'%d',//CNT_is_EU
995
+					'%d',//CNT_active
996
+			);
997
+			$success = $wpdb->insert($country_table,
998
+					$cols_n_values,
999
+					$data_types);
1000
+			if ( ! $success) {
1001
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1002
+						array('country_id' => $country_name), $country_table, $cols_n_values, $data_types));
1003
+			}
1004
+			$country = $cols_n_values;
1005
+		}
1006
+		return $country;
1007
+	}
1008
+
1009
+
1010
+
1011
+	/**
1012
+	 * finds a country iso which hasnt been used yet
1013
+	 *
1014
+	 * @global type $wpdb
1015
+	 * @return string
1016
+	 */
1017
+	private function _find_available_country_iso($num_letters = 2)
1018
+	{
1019
+		global $wpdb;
1020
+		$country_table = $wpdb->prefix . "esp_country";
1021
+		$attempts = 0;
1022
+		do {
1023
+			$current_iso = strtoupper(wp_generate_password($num_letters, false));
1024
+			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM "
1025
+																   . $country_table
1026
+																   . " WHERE CNT_ISO=%s", $current_iso));
1027
+			$attempts++;
1028
+			//keep going until we find an available country code, or we arbitrarily
1029
+			//decide we've tried this enough. Somehow they have way too many countries
1030
+			//(probably because they're mis-using the EE3 country_id like a custom question)
1031
+		} while (intval($country_with_that_iso) && $attempts < 200);
1032
+		return $current_iso;
1033
+	}
1034
+
1035
+
1036
+
1037
+	/**
1038
+	 * Gets a state entry as an array, or creates one if none is found. Much like EEM_State::instance()->get_one(), but
1039
+	 * is independent of outside code which can change in future versions of EE
1040
+	 *
1041
+	 * @global type  $wpdb
1042
+	 * @param string $state_name
1043
+	 * @return array where keys are columns, values are column values
1044
+	 */
1045
+	public function get_or_create_state($state_name, $country_name = '')
1046
+	{
1047
+		if ( ! $state_name) {
1048
+			throw new EE_Error(esc_html__("Could not get-or-create state because no state name was provided",
1049
+					"event_espresso"));
1050
+		}
1051
+		try {
1052
+			$country = $this->get_or_create_country($country_name);
1053
+			$country_iso = $country['CNT_ISO'];
1054
+		} catch (EE_Error $e) {
1055
+			$country_iso = $this->get_default_country_iso();
1056
+		}
1057
+		global $wpdb;
1058
+		$state_table = $wpdb->prefix . "esp_state";
1059
+		$state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1060 1060
 			(STA_abbrev LIKE %s OR
1061 1061
 			STA_name LIKE %s) AND
1062 1062
 			CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A);
1063
-        if ( ! $state) {
1064
-            //insert a new one then
1065
-            $cols_n_values = array(
1066
-                    'CNT_ISO'    => $country_iso,
1067
-                    'STA_abbrev' => substr($state_name, 0, 6),
1068
-                    'STA_name'   => $state_name,
1069
-                    'STA_active' => true,
1070
-            );
1071
-            $data_types = array(
1072
-                    '%s',//CNT_ISO
1073
-                    '%s',//STA_abbrev
1074
-                    '%s',//STA_name
1075
-                    '%d',//STA_active
1076
-            );
1077
-            $success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1078
-            if ( ! $success) {
1079
-                throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1080
-                        array('state' => $state_name, 'country_id' => $country_name), $state_table, $cols_n_values,
1081
-                        $data_types));
1082
-            }
1083
-            $state = $cols_n_values;
1084
-            $state['STA_ID'] = $wpdb->insert_id;
1085
-        }
1086
-        return $state;
1087
-    }
1088
-
1089
-
1090
-
1091
-    /**
1092
-     * Fixes times like "5:00 PM" into the expected 24-hour format "17:00".
1093
-     * THis is actually just copied from the 3.1 JSON API because it needed to do the exact same thing
1094
-     *
1095
-     * @param type $timeString
1096
-     * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes
1097
-     *                with leading zeros)
1098
-     */
1099
-    public function convertTimeFromAMPM($timeString)
1100
-    {
1101
-        $matches = array();
1102
-        preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1103
-        if ( ! $matches || count($matches) < 3) {
1104
-            $hour = '00';
1105
-            $minutes = '00';
1106
-        } else {
1107
-            $hour = intval($matches[1]);
1108
-            $minutes = $matches[2];
1109
-        }
1110
-        if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1111
-            $hour = intval($hour) + 12;
1112
-        }
1113
-        $hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1114
-        $minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1115
-        return "$hour:$minutes";
1116
-    }
1117
-
1118
-
1119
-
1120
-    /**
1121
-     * Gets the ISO3 fora country given its 3.1 country ID.
1122
-     *
1123
-     * @param int $country_id
1124
-     * @return string the country's ISO3 code
1125
-     */
1126
-    public function get_iso_from_3_1_country_id($country_id)
1127
-    {
1128
-        $old_countries = array(
1129
-                array(64, 'United States', 'US', 'USA', 1),
1130
-                array(15, 'Australia', 'AU', 'AUS', 1),
1131
-                array(39, 'Canada', 'CA', 'CAN', 1),
1132
-                array(171, 'United Kingdom', 'GB', 'GBR', 1),
1133
-                array(70, 'France', 'FR', 'FRA', 2),
1134
-                array(111, 'Italy', 'IT', 'ITA', 2),
1135
-                array(63, 'Spain', 'ES', 'ESP', 2),
1136
-                array(1, 'Afghanistan', 'AF', 'AFG', 1),
1137
-                array(2, 'Albania', 'AL', 'ALB', 1),
1138
-                array(3, 'Germany', 'DE', 'DEU', 2),
1139
-                array(198, 'Switzerland', 'CH', 'CHE', 1),
1140
-                array(87, 'Netherlands', 'NL', 'NLD', 2),
1141
-                array(197, 'Sweden', 'SE', 'SWE', 1),
1142
-                array(230, 'Akrotiri and Dhekelia', 'CY', 'CYP', 2),
1143
-                array(4, 'Andorra', 'AD', 'AND', 2),
1144
-                array(5, 'Angola', 'AO', 'AGO', 1),
1145
-                array(6, 'Anguilla', 'AI', 'AIA', 1),
1146
-                array(7, 'Antarctica', 'AQ', 'ATA', 1),
1147
-                array(8, 'Antigua and Barbuda', 'AG', 'ATG', 1),
1148
-                array(10, 'Saudi Arabia', 'SA', 'SAU', 1),
1149
-                array(11, 'Algeria', 'DZ', 'DZA', 1),
1150
-                array(12, 'Argentina', 'AR', 'ARG', 1),
1151
-                array(13, 'Armenia', 'AM', 'ARM', 1),
1152
-                array(14, 'Aruba', 'AW', 'ABW', 1),
1153
-                array(16, 'Austria', 'AT', 'AUT', 2),
1154
-                array(17, 'Azerbaijan', 'AZ', 'AZE', 1),
1155
-                array(18, 'Bahamas', 'BS', 'BHS', 1),
1156
-                array(19, 'Bahrain', 'BH', 'BHR', 1),
1157
-                array(20, 'Bangladesh', 'BD', 'BGD', 1),
1158
-                array(21, 'Barbados', 'BB', 'BRB', 1),
1159
-                array(22, 'Belgium ', 'BE', 'BEL', 2),
1160
-                array(23, 'Belize', 'BZ', 'BLZ', 1),
1161
-                array(24, 'Benin', 'BJ', 'BEN', 1),
1162
-                array(25, 'Bermudas', 'BM', 'BMU', 1),
1163
-                array(26, 'Belarus', 'BY', 'BLR', 1),
1164
-                array(27, 'Bolivia', 'BO', 'BOL', 1),
1165
-                array(28, 'Bosnia and Herzegovina', 'BA', 'BIH', 1),
1166
-                array(29, 'Botswana', 'BW', 'BWA', 1),
1167
-                array(96, 'Bouvet Island', 'BV', 'BVT', 1),
1168
-                array(30, 'Brazil', 'BR', 'BRA', 1),
1169
-                array(31, 'Brunei', 'BN', 'BRN', 1),
1170
-                array(32, 'Bulgaria', 'BG', 'BGR', 1),
1171
-                array(33, 'Burkina Faso', 'BF', 'BFA', 1),
1172
-                array(34, 'Burundi', 'BI', 'BDI', 1),
1173
-                array(35, 'Bhutan', 'BT', 'BTN', 1),
1174
-                array(36, 'Cape Verde', 'CV', 'CPV', 1),
1175
-                array(37, 'Cambodia', 'KH', 'KHM', 1),
1176
-                array(38, 'Cameroon', 'CM', 'CMR', 1),
1177
-                array(98, 'Cayman Islands', 'KY', 'CYM', 1),
1178
-                array(172, 'Central African Republic', 'CF', 'CAF', 1),
1179
-                array(40, 'Chad', 'TD', 'TCD', 1),
1180
-                array(41, 'Chile', 'CL', 'CHL', 1),
1181
-                array(42, 'China', 'CN', 'CHN', 1),
1182
-                array(105, 'Christmas Island', 'CX', 'CXR', 1),
1183
-                array(43, 'Cyprus', 'CY', 'CYP', 2),
1184
-                array(99, 'Cocos Island', 'CC', 'CCK', 1),
1185
-                array(100, 'Cook Islands', 'CK', 'COK', 1),
1186
-                array(44, 'Colombia', 'CO', 'COL', 1),
1187
-                array(45, 'Comoros', 'KM', 'COM', 1),
1188
-                array(46, 'Congo', 'CG', 'COG', 1),
1189
-                array(47, 'North Korea', 'KP', 'PRK', 1),
1190
-                array(50, 'Costa Rica', 'CR', 'CRI', 1),
1191
-                array(51, 'Croatia', 'HR', 'HRV', 1),
1192
-                array(52, 'Cuba', 'CU', 'CUB', 1),
1193
-                array(173, 'Czech Republic', 'CZ', 'CZE', 1),
1194
-                array(53, 'Denmark', 'DK', 'DNK', 1),
1195
-                array(54, 'Djibouti', 'DJ', 'DJI', 1),
1196
-                array(55, 'Dominica', 'DM', 'DMA', 1),
1197
-                array(174, 'Dominican Republic', 'DO', 'DOM', 1),
1198
-                array(56, 'Ecuador', 'EC', 'ECU', 1),
1199
-                array(57, 'Egypt', 'EG', 'EGY', 1),
1200
-                array(58, 'El Salvador', 'SV', 'SLV', 1),
1201
-                array(60, 'Eritrea', 'ER', 'ERI', 1),
1202
-                array(61, 'Slovakia', 'SK', 'SVK', 2),
1203
-                array(62, 'Slovenia', 'SI', 'SVN', 2),
1204
-                array(65, 'Estonia', 'EE', 'EST', 2),
1205
-                array(66, 'Ethiopia', 'ET', 'ETH', 1),
1206
-                array(102, 'Faroe islands', 'FO', 'FRO', 1),
1207
-                array(103, 'Falkland Islands', 'FK', 'FLK', 1),
1208
-                array(67, 'Fiji', 'FJ', 'FJI', 1),
1209
-                array(69, 'Finland', 'FI', 'FIN', 2),
1210
-                array(71, 'Gabon', 'GA', 'GAB', 1),
1211
-                array(72, 'Gambia', 'GM', 'GMB', 1),
1212
-                array(73, 'Georgia', 'GE', 'GEO', 1),
1213
-                array(74, 'Ghana', 'GH', 'GHA', 1),
1214
-                array(75, 'Gibraltar', 'GI', 'GIB', 1),
1215
-                array(76, 'Greece', 'GR', 'GRC', 2),
1216
-                array(77, 'Grenada', 'GD', 'GRD', 1),
1217
-                array(78, 'Greenland', 'GL', 'GRL', 1),
1218
-                array(79, 'Guadeloupe', 'GP', 'GLP', 1),
1219
-                array(80, 'Guam', 'GU', 'GUM', 1),
1220
-                array(81, 'Guatemala', 'GT', 'GTM', 1),
1221
-                array(82, 'Guinea', 'GN', 'GIN', 1),
1222
-                array(83, 'Equatorial Guinea', 'GQ', 'GNQ', 1),
1223
-                array(84, 'Guinea-Bissau', 'GW', 'GNB', 1),
1224
-                array(85, 'Guyana', 'GY', 'GUY', 1),
1225
-                array(86, 'Haiti', 'HT', 'HTI', 1),
1226
-                array(88, 'Honduras', 'HN', 'HND', 1),
1227
-                array(89, 'Hong Kong', 'HK', 'HKG', 1),
1228
-                array(90, 'Hungary', 'HU', 'HUN', 1),
1229
-                array(91, 'India', 'IN', 'IND', 1),
1230
-                array(205, 'British Indian Ocean Territory', 'IO', 'IOT', 1),
1231
-                array(92, 'Indonesia', 'ID', 'IDN', 1),
1232
-                array(93, 'Iraq', 'IQ', 'IRQ', 1),
1233
-                array(94, 'Iran', 'IR', 'IRN', 1),
1234
-                array(95, 'Ireland', 'IE', 'IRL', 2),
1235
-                array(97, 'Iceland', 'IS', 'ISL', 1),
1236
-                array(110, 'Israel', 'IL', 'ISR', 1),
1237
-                array(49, 'Ivory Coast ', 'CI', 'CIV', 1),
1238
-                array(112, 'Jamaica', 'JM', 'JAM', 1),
1239
-                array(113, 'Japan', 'JP', 'JPN', 1),
1240
-                array(114, 'Jordan', 'JO', 'JOR', 1),
1241
-                array(115, 'Kazakhstan', 'KZ', 'KAZ', 1),
1242
-                array(116, 'Kenya', 'KE', 'KEN', 1),
1243
-                array(117, 'Kyrgyzstan', 'KG', 'KGZ', 1),
1244
-                array(118, 'Kiribati', 'KI', 'KIR', 1),
1245
-                array(48, 'South Korea', 'KR', 'KOR', 1),
1246
-                array(228, 'Kosovo', 'XK', 'XKV', 2),
1247
-                // there is no official ISO code for Kosovo yet (http://geonames.wordpress.com/2010/03/08/xk-country-code-for-kosovo/) so using a temporary country code and a modified 3 character code for ISO code -- this should be updated if/when Kosovo gets its own ISO code
1248
-                array(119, 'Kuwait', 'KW', 'KWT', 1),
1249
-                array(120, 'Laos', 'LA', 'LAO', 1),
1250
-                array(121, 'Latvia', 'LV', 'LVA', 2),
1251
-                array(122, 'Lesotho', 'LS', 'LSO', 1),
1252
-                array(123, 'Lebanon', 'LB', 'LBN', 1),
1253
-                array(124, 'Liberia', 'LR', 'LBR', 1),
1254
-                array(125, 'Libya', 'LY', 'LBY', 1),
1255
-                array(126, 'Liechtenstein', 'LI', 'LIE', 1),
1256
-                array(127, 'Lithuania', 'LT', 'LTU', 2),
1257
-                array(128, 'Luxemburg', 'LU', 'LUX', 2),
1258
-                array(129, 'Macao', 'MO', 'MAC', 1),
1259
-                array(130, 'Macedonia', 'MK', 'MKD', 1),
1260
-                array(131, 'Madagascar', 'MG', 'MDG', 1),
1261
-                array(132, 'Malaysia', 'MY', 'MYS', 1),
1262
-                array(133, 'Malawi', 'MW', 'MWI', 1),
1263
-                array(134, 'Maldivas', 'MV', 'MDV', 1),
1264
-                array(135, 'Mali', 'ML', 'MLI', 1),
1265
-                array(136, 'Malta', 'MT', 'MLT', 2),
1266
-                array(101, 'Northern Marianas', 'MP', 'MNP', 1),
1267
-                array(137, 'Morocco', 'MA', 'MAR', 1),
1268
-                array(104, 'Marshall islands', 'MH', 'MHL', 1),
1269
-                array(138, 'Martinique', 'MQ', 'MTQ', 1),
1270
-                array(139, 'Mauritius', 'MU', 'MUS', 1),
1271
-                array(140, 'Mauritania', 'MR', 'MRT', 1),
1272
-                array(141, 'Mayote', 'YT', 'MYT', 2),
1273
-                array(142, 'Mexico', 'MX', 'MEX', 1),
1274
-                array(143, 'Micronesia', 'FM', 'FSM', 1),
1275
-                array(144, 'Moldova', 'MD', 'MDA', 1),
1276
-                array(145, 'Monaco', 'MC', 'MCO', 2),
1277
-                array(146, 'Mongolia', 'MN', 'MNG', 1),
1278
-                array(147, 'Montserrat', 'MS', 'MSR', 1),
1279
-                array(227, 'Montenegro', 'ME', 'MNE', 2),
1280
-                array(148, 'Mozambique', 'MZ', 'MOZ', 1),
1281
-                array(149, 'Myanmar', 'MM', 'MMR', 1),
1282
-                array(150, 'Namibia', 'NA', 'NAM', 1),
1283
-                array(151, 'Nauru', 'NR', 'NRU', 1),
1284
-                array(152, 'Nepal', 'NP', 'NPL', 1),
1285
-                array(9, 'Netherlands Antilles', 'AN', 'ANT', 1),
1286
-                array(153, 'Nicaragua', 'NI', 'NIC', 1),
1287
-                array(154, 'Niger', 'NE', 'NER', 1),
1288
-                array(155, 'Nigeria', 'NG', 'NGA', 1),
1289
-                array(156, 'Niue', 'NU', 'NIU', 1),
1290
-                array(157, 'Norway', 'NO', 'NOR', 1),
1291
-                array(158, 'New Caledonia', 'NC', 'NCL', 1),
1292
-                array(159, 'New Zealand', 'NZ', 'NZL', 1),
1293
-                array(160, 'Oman', 'OM', 'OMN', 1),
1294
-                array(161, 'Pakistan', 'PK', 'PAK', 1),
1295
-                array(162, 'Palau', 'PW', 'PLW', 1),
1296
-                array(163, 'Panama', 'PA', 'PAN', 1),
1297
-                array(164, 'Papua New Guinea', 'PG', 'PNG', 1),
1298
-                array(165, 'Paraguay', 'PY', 'PRY', 1),
1299
-                array(166, 'Peru', 'PE', 'PER', 1),
1300
-                array(68, 'Philippines', 'PH', 'PHL', 1),
1301
-                array(167, 'Poland', 'PL', 'POL', 1),
1302
-                array(168, 'Portugal', 'PT', 'PRT', 2),
1303
-                array(169, 'Puerto Rico', 'PR', 'PRI', 1),
1304
-                array(170, 'Qatar', 'QA', 'QAT', 1),
1305
-                array(176, 'Rwanda', 'RW', 'RWA', 1),
1306
-                array(177, 'Romania', 'RO', 'ROM', 2),
1307
-                array(178, 'Russia', 'RU', 'RUS', 1),
1308
-                array(229, 'Saint Pierre and Miquelon', 'PM', 'SPM', 2),
1309
-                array(180, 'Samoa', 'WS', 'WSM', 1),
1310
-                array(181, 'American Samoa', 'AS', 'ASM', 1),
1311
-                array(183, 'San Marino', 'SM', 'SMR', 2),
1312
-                array(184, 'Saint Vincent and the Grenadines', 'VC', 'VCT', 1),
1313
-                array(185, 'Saint Helena', 'SH', 'SHN', 1),
1314
-                array(186, 'Saint Lucia', 'LC', 'LCA', 1),
1315
-                array(188, 'Senegal', 'SN', 'SEN', 1),
1316
-                array(189, 'Seychelles', 'SC', 'SYC', 1),
1317
-                array(190, 'Sierra Leona', 'SL', 'SLE', 1),
1318
-                array(191, 'Singapore', 'SG', 'SGP', 1),
1319
-                array(192, 'Syria', 'SY', 'SYR', 1),
1320
-                array(193, 'Somalia', 'SO', 'SOM', 1),
1321
-                array(194, 'Sri Lanka', 'LK', 'LKA', 1),
1322
-                array(195, 'South Africa', 'ZA', 'ZAF', 1),
1323
-                array(196, 'Sudan', 'SD', 'SDN', 1),
1324
-                array(199, 'Suriname', 'SR', 'SUR', 1),
1325
-                array(200, 'Swaziland', 'SZ', 'SWZ', 1),
1326
-                array(201, 'Thailand', 'TH', 'THA', 1),
1327
-                array(202, 'Taiwan', 'TW', 'TWN', 1),
1328
-                array(203, 'Tanzania', 'TZ', 'TZA', 1),
1329
-                array(204, 'Tajikistan', 'TJ', 'TJK', 1),
1330
-                array(206, 'Timor-Leste', 'TL', 'TLS', 1),
1331
-                array(207, 'Togo', 'TG', 'TGO', 1),
1332
-                array(208, 'Tokelau', 'TK', 'TKL', 1),
1333
-                array(209, 'Tonga', 'TO', 'TON', 1),
1334
-                array(210, 'Trinidad and Tobago', 'TT', 'TTO', 1),
1335
-                array(211, 'Tunisia', 'TN', 'TUN', 1),
1336
-                array(212, 'Turkmenistan', 'TM', 'TKM', 1),
1337
-                array(213, 'Turkey', 'TR', 'TUR', 1),
1338
-                array(214, 'Tuvalu', 'TV', 'TUV', 1),
1339
-                array(215, 'Ukraine', 'UA', 'UKR', 1),
1340
-                array(216, 'Uganda', 'UG', 'UGA', 1),
1341
-                array(59, 'United Arab Emirates', 'AE', 'ARE', 1),
1342
-                array(217, 'Uruguay', 'UY', 'URY', 1),
1343
-                array(218, 'Uzbekistan', 'UZ', 'UZB', 1),
1344
-                array(219, 'Vanuatu', 'VU', 'VUT', 1),
1345
-                array(220, 'Vatican City', 'VA', 'VAT', 2),
1346
-                array(221, 'Venezuela', 'VE', 'VEN', 1),
1347
-                array(222, 'Vietnam', 'VN', 'VNM', 1),
1348
-                array(108, 'Virgin Islands', 'VI', 'VIR', 1),
1349
-                array(223, 'Yemen', 'YE', 'YEM', 1),
1350
-                array(225, 'Zambia', 'ZM', 'ZMB', 1),
1351
-                array(226, 'Zimbabwe', 'ZW', 'ZWE', 1),
1352
-        );
1353
-        $country_iso = 'US';
1354
-        foreach ($old_countries as $country_array) {
1355
-            //note: index 0 is the 3.1 country ID
1356
-            if ($country_array[0] == $country_id) {
1357
-                //note: index 2 is the ISO
1358
-                $country_iso = $country_array[2];
1359
-                break;
1360
-            }
1361
-        }
1362
-        return $country_iso;
1363
-    }
1364
-
1365
-
1366
-
1367
-    /**
1368
-     * Gets the ISO3 for the
1369
-     *
1370
-     * @return string
1371
-     */
1372
-    public function get_default_country_iso()
1373
-    {
1374
-        $old_org_options = get_option('events_organization_settings');
1375
-        $iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1376
-        return $iso;
1377
-    }
1378
-
1379
-
1380
-
1381
-    /**
1382
-     * Converst a 3.1 payment status to its equivalent 4.1 regisration status
1383
-     *
1384
-     * @param string  $payment_status                   possible value for 3.1's evens_attendee.payment_status
1385
-     * @param boolean $this_thing_required_pre_approval whether the thing we're considering (the general setting's
1386
-     *                                                  DEFAULT payment status, the event's DEFAULT payment status, or
1387
-     *                                                  the attendee's payment status) required pre-approval.
1388
-     * @return string STS_ID for use in 4.1
1389
-     */
1390
-    public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false)
1391
-    {
1392
-        //EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1393
-        if ($this_thing_required_pre_approval) {
1394
-            return 'RNA';
1395
-        } else {
1396
-            $mapping = $default_reg_stati_conversions = array(
1397
-                    'Completed'        => 'RAP',
1398
-                    ''                 => 'RPP',
1399
-                    'Incomplete'       => 'RPP',
1400
-                    'Pending'          => 'RAP',
1401
-                    //stati that only occurred on 3.1 attendees:
1402
-                    'Payment Declined' => 'RPP',
1403
-                    'Not Completed'    => 'RPP',
1404
-                    'Cancelled'        => 'RPP',
1405
-                    'Declined'         => 'RPP',
1406
-            );
1407
-        }
1408
-        return isset($mapping[$payment_status]) ? $mapping[$payment_status] : 'RNA';
1409
-    }
1410
-
1411
-
1412
-
1413
-    /**
1414
-     * Makes sure the 3.1's image url is converted to an image attachment post to the 4.1 CPT event
1415
-     * and sets it as the featured image on the CPT event
1416
-     *
1417
-     * @param type                            $old_event
1418
-     * @param type                            $new_cpt_id
1419
-     * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1420
-     * @return boolean whether or not we had to do the big job of creating an image attachment
1421
-     */
1422
-    public function convert_image_url_to_attachment_and_attach_to_post(
1423
-            $guid,
1424
-            $new_cpt_id,
1425
-            EE_Data_Migration_Script_Stage $migration_stage
1426
-    ) {
1427
-        $created_attachment_post = false;
1428
-        $guid = $this->_get_original_guid($guid);
1429
-        if ($guid) {
1430
-            //check for an existing attachment post with this guid
1431
-            $attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1432
-            if ( ! $attachment_post_id) {
1433
-                //post thumbnail with that GUID doesn't exist, we should create one
1434
-                $attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1435
-                $created_attachment_post = true;
1436
-            }
1437
-            //double-check we actually have an attachment post
1438
-            if ($attachment_post_id) {
1439
-                update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1440
-            } else {
1441
-                $migration_stage->add_error(sprintf(esc_html__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d",
1442
-                        "event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1443
-            }
1444
-        }
1445
-        return $created_attachment_post;
1446
-    }
1447
-
1448
-
1449
-
1450
-    /**
1451
-     * In 3.1, the event thumbnail image DOESN'T point to the orignal image, but instead
1452
-     * to a large thumbnail (which has nearly the same GUID, except it adds "-{width}x{height}" before the filetype,
1453
-     * or whatever dimensions it is. Eg 'http://mysite.com/image1-300x400.jpg' instead of
1454
-     * 'http://mysite.com/image1.jpg' ). This function attempts to strip that off and get the original file, if it
1455
-     * exists
1456
-     *
1457
-     * @param string $guid_in_old_event
1458
-     * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1459
-     */
1460
-    private function _get_original_guid($guid_in_old_event)
1461
-    {
1462
-        $original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1463
-        //do a head request to verify the file exists
1464
-        $head_response = wp_remote_head($original_guid);
1465
-        if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1466
-            return $original_guid;
1467
-        } else {
1468
-            return $guid_in_old_event;
1469
-        }
1470
-    }
1471
-
1472
-
1473
-
1474
-    /**
1475
-     * Creates an image attachment post for the GUID. If the GUID points to a remote image,
1476
-     * we download it to our uploads directory so that it can be properly processed (eg, creates different sizes of
1477
-     * thumbnails)
1478
-     *
1479
-     * @param type                           $guid
1480
-     * @param EE_Data_Migration_Script_Stage $migration_stage
1481
-     * @return int
1482
-     */
1483
-    private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage)
1484
-    {
1485
-        if ( ! $guid) {
1486
-            $migration_stage->add_error(sprintf(esc_html__("Cannot create image attachment for a blank GUID!",
1487
-                    "event_espresso")));
1488
-            return 0;
1489
-        }
1490
-        $wp_filetype = wp_check_filetype(basename($guid), null);
1491
-        $wp_upload_dir = wp_upload_dir();
1492
-        //if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1493
-        if (strpos($guid, $wp_upload_dir['url']) === false) {
1494
-            //image is located remotely. download it and place it in the uploads directory
1495
-            if ( ! is_readable($guid)) {
1496
-                $migration_stage->add_error(sprintf(esc_html__("Could not create image attachment from non-existent file: %s",
1497
-                        "event_espresso"), $guid));
1498
-                return 0;
1499
-            }
1500
-            $contents = file_get_contents($guid);
1501
-            if ($contents === false) {
1502
-                $migration_stage->add_error(sprintf(esc_html__("Could not read image at %s, and therefore couldnt create an attachment post for it.",
1503
-                        "event_espresso"), $guid));
1504
-                return false;
1505
-            }
1506
-            $local_filepath = $wp_upload_dir['path'] . DS . basename($guid);
1507
-            $savefile = fopen($local_filepath, 'w');
1508
-            fwrite($savefile, $contents);
1509
-            fclose($savefile);
1510
-            $guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1511
-        } else {
1512
-            $local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1513
-        }
1514
-        $attachment = array(
1515
-                'guid'           => $guid,
1516
-                'post_mime_type' => $wp_filetype['type'],
1517
-                'post_title'     => preg_replace('/\.[^.]+$/', '', basename($guid)),
1518
-                'post_content'   => '',
1519
-                'post_status'    => 'inherit',
1520
-        );
1521
-        $attach_id = wp_insert_attachment($attachment, $guid);
1522
-        if ( ! $attach_id) {
1523
-            $migration_stage->add_error(sprintf(esc_html__("Could not create image attachment post from image '%s'. Attachment data was %s.",
1524
-                    "event_espresso"), $guid, $this->_json_encode($attachment)));
1525
-            return $attach_id;
1526
-        }
1527
-        // you must first include the image.php file
1528
-        // for the function wp_generate_attachment_metadata() to work
1529
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1530
-        $attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1531
-        if ( ! $attach_data) {
1532
-            $migration_stage->add_error(sprintf(esc_html__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.",
1533
-                    "event_espresso"), $attach_id, $local_filepath, $guid));
1534
-            return $attach_id;
1535
-        }
1536
-        $metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1537
-        if ( ! $metadata_save_result) {
1538
-            $migration_stage->add_error(sprintf(esc_html__("Could not update attachment metadata for attachment %d with data %s",
1539
-                    "event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1540
-        }
1541
-        return $attach_id;
1542
-    }
1543
-
1544
-
1545
-
1546
-    /**
1547
-     * Finds the attachment post containing info about an image attachment given the GUID (link to the image itself),
1548
-     * and returns its ID.
1549
-     *
1550
-     * @global type  $wpdb
1551
-     * @param string $guid
1552
-     * @return int
1553
-     */
1554
-    private function _get_image_attachment_id_by_GUID($guid)
1555
-    {
1556
-        global $wpdb;
1557
-        $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1558
-        return $attachment_id;
1559
-    }
1560
-
1561
-
1562
-
1563
-    /**
1564
-     * Returns a mysql-formatted DATETIME in UTC time, given a $DATETIME_string
1565
-     * (and optionally a timezone; if none is given, the wp DEFAULT is used)
1566
-     *
1567
-     * @param EE_Data_Migration_Script_base $stage
1568
-     * @param array                         $row_of_data , the row from the DB (as an array) we're trying to find the
1569
-     *                                                   UTC time for
1570
-     * @param string                        $DATETIME_string
1571
-     * @param string                        $timezone
1572
-     * @return string
1573
-     */
1574
-    public function convert_date_string_to_utc(
1575
-            EE_Data_Migration_Script_Stage $stage,
1576
-            $row_of_data,
1577
-            $DATETIME_string,
1578
-            $timezone = null
1579
-    ) {
1580
-        $original_tz = $timezone;
1581
-        if ( ! $timezone) {
1582
-            $timezone = $this->_get_wp_timezone();
1583
-        }
1584
-        if ( ! $timezone) {
1585
-            $stage->add_error(sprintf(esc_html__("Could not find timezone given %s for %s", "event_espresso"), $original_tz,
1586
-                    $row_of_data));
1587
-            $timezone = 'UTC';
1588
-        }
1589
-        try {
1590
-            $date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1591
-            EEH_DTT_Helper::setTimezone($date_obj, new DateTimeZone('UTC'));
1592
-        } catch (Exception $e) {
1593
-            $stage->add_error(sprintf(esc_html__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.",
1594
-                    "event_espresso"), $DATETIME_string, $timezone));
1595
-            $date_obj = new DateTime();
1596
-        }
1597
-        return $date_obj->format('Y-m-d H:i:s');
1598
-    }
1599
-
1600
-
1601
-
1602
-    /**
1603
-     * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1604
-     *
1605
-     * @return string
1606
-     */
1607
-    private function _get_wp_timezone()
1608
-    {
1609
-        $timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1610
-        //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1611
-        if (empty($timezone)) {
1612
-            //let's get a the WordPress UTC offset
1613
-            $offset = get_option('gmt_offset');
1614
-            $timezone = $this->timezone_convert_to_string_from_offset($offset);
1615
-        }
1616
-        return $timezone;
1617
-    }
1618
-
1619
-
1620
-
1621
-    /**
1622
-     * Gets the wordpress timezone string from a UTC offset
1623
-     *
1624
-     * @param int $offset
1625
-     * @return boolean
1626
-     */
1627
-    private function timezone_convert_to_string_from_offset($offset)
1628
-    {
1629
-        //shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
1630
-        $offset *= 3600; // convert hour offset to seconds
1631
-        $abbrarray = timezone_abbreviations_list();
1632
-        foreach ($abbrarray as $abbr) {
1633
-            foreach ($abbr as $city) {
1634
-                if ($city['offset'] == $offset) {
1635
-                    return $city['timezone_id'];
1636
-                }
1637
-            }
1638
-        }
1639
-        return false;
1640
-    }
1641
-
1642
-
1643
-
1644
-    public function migration_page_hooks()
1645
-    {
1646
-        add_filter(
1647
-                'FHEE__ee_migration_page__header',
1648
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1649
-                10,
1650
-                3
1651
-        );
1652
-        add_filter(
1653
-                'FHEE__ee_migration_page__p_after_header',
1654
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1655
-                10,
1656
-                2
1657
-        );
1658
-        add_filter(
1659
-                'FHEE__ee_migration_page__option_1_main',
1660
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1661
-                10,
1662
-                3
1663
-        );
1664
-        add_filter(
1665
-                'FHEE__ee_migration_page__option_1_button_text',
1666
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1667
-                10,
1668
-                3
1669
-        );
1670
-        add_action(
1671
-                'AHEE__ee_migration_page__option_1_extra_details',
1672
-                array($this, '_migration_page_hook_option_1_extra_details'),
1673
-                10,
1674
-                3
1675
-        );
1676
-        add_filter(
1677
-                'FHEE__ee_migration_page__option_2_main',
1678
-                array($this, '_migrate_page_hook_simplify_version_strings'),
1679
-                10,
1680
-                4
1681
-        );
1682
-        add_filter(
1683
-                'FHEE__ee_migration_page__option_2_button_text',
1684
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1685
-                10,
1686
-                2
1687
-        );
1688
-        add_filter(
1689
-                'FHEE__ee_migration_page__option_2_details',
1690
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1691
-                10,
1692
-                2
1693
-        );
1694
-        add_action(
1695
-                'AHEE__ee_migration_page__after_migration_options_table',
1696
-                array($this, '_migration_page_hook_after_migration_options_table')
1697
-        );
1698
-        add_filter(
1699
-                'FHEE__ee_migration_page__done_migration_header',
1700
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1701
-                10,
1702
-                2
1703
-        );
1704
-        add_filter(
1705
-                'FHEE__ee_migration_page__p_after_done_migration_header',
1706
-                array($this, '_migration_page_hook_simplify_next_db_state'),
1707
-                10,
1708
-                2
1709
-        );
1710
-        add_filter(
1711
-                'FHEE__ee_migration_page__migration_options_template',
1712
-                array($this,'use_migration_options_from_ee3_template')
1713
-        );
1714
-    }
1715
-
1716
-
1717
-
1718
-    public function _migrate_page_hook_simplify_version_strings(
1719
-            $old_content,
1720
-            $current_db_state,
1721
-            $next_db_state,
1722
-            $ultimate_db_state = null
1723
-    ) {
1724
-        return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state),
1725
-                array(esc_html__('EE3', 'event_espresso'), esc_html__('EE4', 'event_espresso'), esc_html__("EE4", 'event_espresso')),
1726
-                $old_content);
1727
-    }
1728
-
1729
-
1730
-
1731
-    public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state)
1732
-    {
1733
-        return str_replace($next_db_state, esc_html__("EE4", 'event_espresso'), $old_content);
1734
-    }
1735
-
1736
-
1737
-
1738
-    public function _migration_page_hook_option_1_extra_details()
1739
-    {
1740
-        ?>
1063
+		if ( ! $state) {
1064
+			//insert a new one then
1065
+			$cols_n_values = array(
1066
+					'CNT_ISO'    => $country_iso,
1067
+					'STA_abbrev' => substr($state_name, 0, 6),
1068
+					'STA_name'   => $state_name,
1069
+					'STA_active' => true,
1070
+			);
1071
+			$data_types = array(
1072
+					'%s',//CNT_ISO
1073
+					'%s',//STA_abbrev
1074
+					'%s',//STA_name
1075
+					'%d',//STA_active
1076
+			);
1077
+			$success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1078
+			if ( ! $success) {
1079
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A',
1080
+						array('state' => $state_name, 'country_id' => $country_name), $state_table, $cols_n_values,
1081
+						$data_types));
1082
+			}
1083
+			$state = $cols_n_values;
1084
+			$state['STA_ID'] = $wpdb->insert_id;
1085
+		}
1086
+		return $state;
1087
+	}
1088
+
1089
+
1090
+
1091
+	/**
1092
+	 * Fixes times like "5:00 PM" into the expected 24-hour format "17:00".
1093
+	 * THis is actually just copied from the 3.1 JSON API because it needed to do the exact same thing
1094
+	 *
1095
+	 * @param type $timeString
1096
+	 * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes
1097
+	 *                with leading zeros)
1098
+	 */
1099
+	public function convertTimeFromAMPM($timeString)
1100
+	{
1101
+		$matches = array();
1102
+		preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1103
+		if ( ! $matches || count($matches) < 3) {
1104
+			$hour = '00';
1105
+			$minutes = '00';
1106
+		} else {
1107
+			$hour = intval($matches[1]);
1108
+			$minutes = $matches[2];
1109
+		}
1110
+		if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1111
+			$hour = intval($hour) + 12;
1112
+		}
1113
+		$hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1114
+		$minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1115
+		return "$hour:$minutes";
1116
+	}
1117
+
1118
+
1119
+
1120
+	/**
1121
+	 * Gets the ISO3 fora country given its 3.1 country ID.
1122
+	 *
1123
+	 * @param int $country_id
1124
+	 * @return string the country's ISO3 code
1125
+	 */
1126
+	public function get_iso_from_3_1_country_id($country_id)
1127
+	{
1128
+		$old_countries = array(
1129
+				array(64, 'United States', 'US', 'USA', 1),
1130
+				array(15, 'Australia', 'AU', 'AUS', 1),
1131
+				array(39, 'Canada', 'CA', 'CAN', 1),
1132
+				array(171, 'United Kingdom', 'GB', 'GBR', 1),
1133
+				array(70, 'France', 'FR', 'FRA', 2),
1134
+				array(111, 'Italy', 'IT', 'ITA', 2),
1135
+				array(63, 'Spain', 'ES', 'ESP', 2),
1136
+				array(1, 'Afghanistan', 'AF', 'AFG', 1),
1137
+				array(2, 'Albania', 'AL', 'ALB', 1),
1138
+				array(3, 'Germany', 'DE', 'DEU', 2),
1139
+				array(198, 'Switzerland', 'CH', 'CHE', 1),
1140
+				array(87, 'Netherlands', 'NL', 'NLD', 2),
1141
+				array(197, 'Sweden', 'SE', 'SWE', 1),
1142
+				array(230, 'Akrotiri and Dhekelia', 'CY', 'CYP', 2),
1143
+				array(4, 'Andorra', 'AD', 'AND', 2),
1144
+				array(5, 'Angola', 'AO', 'AGO', 1),
1145
+				array(6, 'Anguilla', 'AI', 'AIA', 1),
1146
+				array(7, 'Antarctica', 'AQ', 'ATA', 1),
1147
+				array(8, 'Antigua and Barbuda', 'AG', 'ATG', 1),
1148
+				array(10, 'Saudi Arabia', 'SA', 'SAU', 1),
1149
+				array(11, 'Algeria', 'DZ', 'DZA', 1),
1150
+				array(12, 'Argentina', 'AR', 'ARG', 1),
1151
+				array(13, 'Armenia', 'AM', 'ARM', 1),
1152
+				array(14, 'Aruba', 'AW', 'ABW', 1),
1153
+				array(16, 'Austria', 'AT', 'AUT', 2),
1154
+				array(17, 'Azerbaijan', 'AZ', 'AZE', 1),
1155
+				array(18, 'Bahamas', 'BS', 'BHS', 1),
1156
+				array(19, 'Bahrain', 'BH', 'BHR', 1),
1157
+				array(20, 'Bangladesh', 'BD', 'BGD', 1),
1158
+				array(21, 'Barbados', 'BB', 'BRB', 1),
1159
+				array(22, 'Belgium ', 'BE', 'BEL', 2),
1160
+				array(23, 'Belize', 'BZ', 'BLZ', 1),
1161
+				array(24, 'Benin', 'BJ', 'BEN', 1),
1162
+				array(25, 'Bermudas', 'BM', 'BMU', 1),
1163
+				array(26, 'Belarus', 'BY', 'BLR', 1),
1164
+				array(27, 'Bolivia', 'BO', 'BOL', 1),
1165
+				array(28, 'Bosnia and Herzegovina', 'BA', 'BIH', 1),
1166
+				array(29, 'Botswana', 'BW', 'BWA', 1),
1167
+				array(96, 'Bouvet Island', 'BV', 'BVT', 1),
1168
+				array(30, 'Brazil', 'BR', 'BRA', 1),
1169
+				array(31, 'Brunei', 'BN', 'BRN', 1),
1170
+				array(32, 'Bulgaria', 'BG', 'BGR', 1),
1171
+				array(33, 'Burkina Faso', 'BF', 'BFA', 1),
1172
+				array(34, 'Burundi', 'BI', 'BDI', 1),
1173
+				array(35, 'Bhutan', 'BT', 'BTN', 1),
1174
+				array(36, 'Cape Verde', 'CV', 'CPV', 1),
1175
+				array(37, 'Cambodia', 'KH', 'KHM', 1),
1176
+				array(38, 'Cameroon', 'CM', 'CMR', 1),
1177
+				array(98, 'Cayman Islands', 'KY', 'CYM', 1),
1178
+				array(172, 'Central African Republic', 'CF', 'CAF', 1),
1179
+				array(40, 'Chad', 'TD', 'TCD', 1),
1180
+				array(41, 'Chile', 'CL', 'CHL', 1),
1181
+				array(42, 'China', 'CN', 'CHN', 1),
1182
+				array(105, 'Christmas Island', 'CX', 'CXR', 1),
1183
+				array(43, 'Cyprus', 'CY', 'CYP', 2),
1184
+				array(99, 'Cocos Island', 'CC', 'CCK', 1),
1185
+				array(100, 'Cook Islands', 'CK', 'COK', 1),
1186
+				array(44, 'Colombia', 'CO', 'COL', 1),
1187
+				array(45, 'Comoros', 'KM', 'COM', 1),
1188
+				array(46, 'Congo', 'CG', 'COG', 1),
1189
+				array(47, 'North Korea', 'KP', 'PRK', 1),
1190
+				array(50, 'Costa Rica', 'CR', 'CRI', 1),
1191
+				array(51, 'Croatia', 'HR', 'HRV', 1),
1192
+				array(52, 'Cuba', 'CU', 'CUB', 1),
1193
+				array(173, 'Czech Republic', 'CZ', 'CZE', 1),
1194
+				array(53, 'Denmark', 'DK', 'DNK', 1),
1195
+				array(54, 'Djibouti', 'DJ', 'DJI', 1),
1196
+				array(55, 'Dominica', 'DM', 'DMA', 1),
1197
+				array(174, 'Dominican Republic', 'DO', 'DOM', 1),
1198
+				array(56, 'Ecuador', 'EC', 'ECU', 1),
1199
+				array(57, 'Egypt', 'EG', 'EGY', 1),
1200
+				array(58, 'El Salvador', 'SV', 'SLV', 1),
1201
+				array(60, 'Eritrea', 'ER', 'ERI', 1),
1202
+				array(61, 'Slovakia', 'SK', 'SVK', 2),
1203
+				array(62, 'Slovenia', 'SI', 'SVN', 2),
1204
+				array(65, 'Estonia', 'EE', 'EST', 2),
1205
+				array(66, 'Ethiopia', 'ET', 'ETH', 1),
1206
+				array(102, 'Faroe islands', 'FO', 'FRO', 1),
1207
+				array(103, 'Falkland Islands', 'FK', 'FLK', 1),
1208
+				array(67, 'Fiji', 'FJ', 'FJI', 1),
1209
+				array(69, 'Finland', 'FI', 'FIN', 2),
1210
+				array(71, 'Gabon', 'GA', 'GAB', 1),
1211
+				array(72, 'Gambia', 'GM', 'GMB', 1),
1212
+				array(73, 'Georgia', 'GE', 'GEO', 1),
1213
+				array(74, 'Ghana', 'GH', 'GHA', 1),
1214
+				array(75, 'Gibraltar', 'GI', 'GIB', 1),
1215
+				array(76, 'Greece', 'GR', 'GRC', 2),
1216
+				array(77, 'Grenada', 'GD', 'GRD', 1),
1217
+				array(78, 'Greenland', 'GL', 'GRL', 1),
1218
+				array(79, 'Guadeloupe', 'GP', 'GLP', 1),
1219
+				array(80, 'Guam', 'GU', 'GUM', 1),
1220
+				array(81, 'Guatemala', 'GT', 'GTM', 1),
1221
+				array(82, 'Guinea', 'GN', 'GIN', 1),
1222
+				array(83, 'Equatorial Guinea', 'GQ', 'GNQ', 1),
1223
+				array(84, 'Guinea-Bissau', 'GW', 'GNB', 1),
1224
+				array(85, 'Guyana', 'GY', 'GUY', 1),
1225
+				array(86, 'Haiti', 'HT', 'HTI', 1),
1226
+				array(88, 'Honduras', 'HN', 'HND', 1),
1227
+				array(89, 'Hong Kong', 'HK', 'HKG', 1),
1228
+				array(90, 'Hungary', 'HU', 'HUN', 1),
1229
+				array(91, 'India', 'IN', 'IND', 1),
1230
+				array(205, 'British Indian Ocean Territory', 'IO', 'IOT', 1),
1231
+				array(92, 'Indonesia', 'ID', 'IDN', 1),
1232
+				array(93, 'Iraq', 'IQ', 'IRQ', 1),
1233
+				array(94, 'Iran', 'IR', 'IRN', 1),
1234
+				array(95, 'Ireland', 'IE', 'IRL', 2),
1235
+				array(97, 'Iceland', 'IS', 'ISL', 1),
1236
+				array(110, 'Israel', 'IL', 'ISR', 1),
1237
+				array(49, 'Ivory Coast ', 'CI', 'CIV', 1),
1238
+				array(112, 'Jamaica', 'JM', 'JAM', 1),
1239
+				array(113, 'Japan', 'JP', 'JPN', 1),
1240
+				array(114, 'Jordan', 'JO', 'JOR', 1),
1241
+				array(115, 'Kazakhstan', 'KZ', 'KAZ', 1),
1242
+				array(116, 'Kenya', 'KE', 'KEN', 1),
1243
+				array(117, 'Kyrgyzstan', 'KG', 'KGZ', 1),
1244
+				array(118, 'Kiribati', 'KI', 'KIR', 1),
1245
+				array(48, 'South Korea', 'KR', 'KOR', 1),
1246
+				array(228, 'Kosovo', 'XK', 'XKV', 2),
1247
+				// there is no official ISO code for Kosovo yet (http://geonames.wordpress.com/2010/03/08/xk-country-code-for-kosovo/) so using a temporary country code and a modified 3 character code for ISO code -- this should be updated if/when Kosovo gets its own ISO code
1248
+				array(119, 'Kuwait', 'KW', 'KWT', 1),
1249
+				array(120, 'Laos', 'LA', 'LAO', 1),
1250
+				array(121, 'Latvia', 'LV', 'LVA', 2),
1251
+				array(122, 'Lesotho', 'LS', 'LSO', 1),
1252
+				array(123, 'Lebanon', 'LB', 'LBN', 1),
1253
+				array(124, 'Liberia', 'LR', 'LBR', 1),
1254
+				array(125, 'Libya', 'LY', 'LBY', 1),
1255
+				array(126, 'Liechtenstein', 'LI', 'LIE', 1),
1256
+				array(127, 'Lithuania', 'LT', 'LTU', 2),
1257
+				array(128, 'Luxemburg', 'LU', 'LUX', 2),
1258
+				array(129, 'Macao', 'MO', 'MAC', 1),
1259
+				array(130, 'Macedonia', 'MK', 'MKD', 1),
1260
+				array(131, 'Madagascar', 'MG', 'MDG', 1),
1261
+				array(132, 'Malaysia', 'MY', 'MYS', 1),
1262
+				array(133, 'Malawi', 'MW', 'MWI', 1),
1263
+				array(134, 'Maldivas', 'MV', 'MDV', 1),
1264
+				array(135, 'Mali', 'ML', 'MLI', 1),
1265
+				array(136, 'Malta', 'MT', 'MLT', 2),
1266
+				array(101, 'Northern Marianas', 'MP', 'MNP', 1),
1267
+				array(137, 'Morocco', 'MA', 'MAR', 1),
1268
+				array(104, 'Marshall islands', 'MH', 'MHL', 1),
1269
+				array(138, 'Martinique', 'MQ', 'MTQ', 1),
1270
+				array(139, 'Mauritius', 'MU', 'MUS', 1),
1271
+				array(140, 'Mauritania', 'MR', 'MRT', 1),
1272
+				array(141, 'Mayote', 'YT', 'MYT', 2),
1273
+				array(142, 'Mexico', 'MX', 'MEX', 1),
1274
+				array(143, 'Micronesia', 'FM', 'FSM', 1),
1275
+				array(144, 'Moldova', 'MD', 'MDA', 1),
1276
+				array(145, 'Monaco', 'MC', 'MCO', 2),
1277
+				array(146, 'Mongolia', 'MN', 'MNG', 1),
1278
+				array(147, 'Montserrat', 'MS', 'MSR', 1),
1279
+				array(227, 'Montenegro', 'ME', 'MNE', 2),
1280
+				array(148, 'Mozambique', 'MZ', 'MOZ', 1),
1281
+				array(149, 'Myanmar', 'MM', 'MMR', 1),
1282
+				array(150, 'Namibia', 'NA', 'NAM', 1),
1283
+				array(151, 'Nauru', 'NR', 'NRU', 1),
1284
+				array(152, 'Nepal', 'NP', 'NPL', 1),
1285
+				array(9, 'Netherlands Antilles', 'AN', 'ANT', 1),
1286
+				array(153, 'Nicaragua', 'NI', 'NIC', 1),
1287
+				array(154, 'Niger', 'NE', 'NER', 1),
1288
+				array(155, 'Nigeria', 'NG', 'NGA', 1),
1289
+				array(156, 'Niue', 'NU', 'NIU', 1),
1290
+				array(157, 'Norway', 'NO', 'NOR', 1),
1291
+				array(158, 'New Caledonia', 'NC', 'NCL', 1),
1292
+				array(159, 'New Zealand', 'NZ', 'NZL', 1),
1293
+				array(160, 'Oman', 'OM', 'OMN', 1),
1294
+				array(161, 'Pakistan', 'PK', 'PAK', 1),
1295
+				array(162, 'Palau', 'PW', 'PLW', 1),
1296
+				array(163, 'Panama', 'PA', 'PAN', 1),
1297
+				array(164, 'Papua New Guinea', 'PG', 'PNG', 1),
1298
+				array(165, 'Paraguay', 'PY', 'PRY', 1),
1299
+				array(166, 'Peru', 'PE', 'PER', 1),
1300
+				array(68, 'Philippines', 'PH', 'PHL', 1),
1301
+				array(167, 'Poland', 'PL', 'POL', 1),
1302
+				array(168, 'Portugal', 'PT', 'PRT', 2),
1303
+				array(169, 'Puerto Rico', 'PR', 'PRI', 1),
1304
+				array(170, 'Qatar', 'QA', 'QAT', 1),
1305
+				array(176, 'Rwanda', 'RW', 'RWA', 1),
1306
+				array(177, 'Romania', 'RO', 'ROM', 2),
1307
+				array(178, 'Russia', 'RU', 'RUS', 1),
1308
+				array(229, 'Saint Pierre and Miquelon', 'PM', 'SPM', 2),
1309
+				array(180, 'Samoa', 'WS', 'WSM', 1),
1310
+				array(181, 'American Samoa', 'AS', 'ASM', 1),
1311
+				array(183, 'San Marino', 'SM', 'SMR', 2),
1312
+				array(184, 'Saint Vincent and the Grenadines', 'VC', 'VCT', 1),
1313
+				array(185, 'Saint Helena', 'SH', 'SHN', 1),
1314
+				array(186, 'Saint Lucia', 'LC', 'LCA', 1),
1315
+				array(188, 'Senegal', 'SN', 'SEN', 1),
1316
+				array(189, 'Seychelles', 'SC', 'SYC', 1),
1317
+				array(190, 'Sierra Leona', 'SL', 'SLE', 1),
1318
+				array(191, 'Singapore', 'SG', 'SGP', 1),
1319
+				array(192, 'Syria', 'SY', 'SYR', 1),
1320
+				array(193, 'Somalia', 'SO', 'SOM', 1),
1321
+				array(194, 'Sri Lanka', 'LK', 'LKA', 1),
1322
+				array(195, 'South Africa', 'ZA', 'ZAF', 1),
1323
+				array(196, 'Sudan', 'SD', 'SDN', 1),
1324
+				array(199, 'Suriname', 'SR', 'SUR', 1),
1325
+				array(200, 'Swaziland', 'SZ', 'SWZ', 1),
1326
+				array(201, 'Thailand', 'TH', 'THA', 1),
1327
+				array(202, 'Taiwan', 'TW', 'TWN', 1),
1328
+				array(203, 'Tanzania', 'TZ', 'TZA', 1),
1329
+				array(204, 'Tajikistan', 'TJ', 'TJK', 1),
1330
+				array(206, 'Timor-Leste', 'TL', 'TLS', 1),
1331
+				array(207, 'Togo', 'TG', 'TGO', 1),
1332
+				array(208, 'Tokelau', 'TK', 'TKL', 1),
1333
+				array(209, 'Tonga', 'TO', 'TON', 1),
1334
+				array(210, 'Trinidad and Tobago', 'TT', 'TTO', 1),
1335
+				array(211, 'Tunisia', 'TN', 'TUN', 1),
1336
+				array(212, 'Turkmenistan', 'TM', 'TKM', 1),
1337
+				array(213, 'Turkey', 'TR', 'TUR', 1),
1338
+				array(214, 'Tuvalu', 'TV', 'TUV', 1),
1339
+				array(215, 'Ukraine', 'UA', 'UKR', 1),
1340
+				array(216, 'Uganda', 'UG', 'UGA', 1),
1341
+				array(59, 'United Arab Emirates', 'AE', 'ARE', 1),
1342
+				array(217, 'Uruguay', 'UY', 'URY', 1),
1343
+				array(218, 'Uzbekistan', 'UZ', 'UZB', 1),
1344
+				array(219, 'Vanuatu', 'VU', 'VUT', 1),
1345
+				array(220, 'Vatican City', 'VA', 'VAT', 2),
1346
+				array(221, 'Venezuela', 'VE', 'VEN', 1),
1347
+				array(222, 'Vietnam', 'VN', 'VNM', 1),
1348
+				array(108, 'Virgin Islands', 'VI', 'VIR', 1),
1349
+				array(223, 'Yemen', 'YE', 'YEM', 1),
1350
+				array(225, 'Zambia', 'ZM', 'ZMB', 1),
1351
+				array(226, 'Zimbabwe', 'ZW', 'ZWE', 1),
1352
+		);
1353
+		$country_iso = 'US';
1354
+		foreach ($old_countries as $country_array) {
1355
+			//note: index 0 is the 3.1 country ID
1356
+			if ($country_array[0] == $country_id) {
1357
+				//note: index 2 is the ISO
1358
+				$country_iso = $country_array[2];
1359
+				break;
1360
+			}
1361
+		}
1362
+		return $country_iso;
1363
+	}
1364
+
1365
+
1366
+
1367
+	/**
1368
+	 * Gets the ISO3 for the
1369
+	 *
1370
+	 * @return string
1371
+	 */
1372
+	public function get_default_country_iso()
1373
+	{
1374
+		$old_org_options = get_option('events_organization_settings');
1375
+		$iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1376
+		return $iso;
1377
+	}
1378
+
1379
+
1380
+
1381
+	/**
1382
+	 * Converst a 3.1 payment status to its equivalent 4.1 regisration status
1383
+	 *
1384
+	 * @param string  $payment_status                   possible value for 3.1's evens_attendee.payment_status
1385
+	 * @param boolean $this_thing_required_pre_approval whether the thing we're considering (the general setting's
1386
+	 *                                                  DEFAULT payment status, the event's DEFAULT payment status, or
1387
+	 *                                                  the attendee's payment status) required pre-approval.
1388
+	 * @return string STS_ID for use in 4.1
1389
+	 */
1390
+	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false)
1391
+	{
1392
+		//EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1393
+		if ($this_thing_required_pre_approval) {
1394
+			return 'RNA';
1395
+		} else {
1396
+			$mapping = $default_reg_stati_conversions = array(
1397
+					'Completed'        => 'RAP',
1398
+					''                 => 'RPP',
1399
+					'Incomplete'       => 'RPP',
1400
+					'Pending'          => 'RAP',
1401
+					//stati that only occurred on 3.1 attendees:
1402
+					'Payment Declined' => 'RPP',
1403
+					'Not Completed'    => 'RPP',
1404
+					'Cancelled'        => 'RPP',
1405
+					'Declined'         => 'RPP',
1406
+			);
1407
+		}
1408
+		return isset($mapping[$payment_status]) ? $mapping[$payment_status] : 'RNA';
1409
+	}
1410
+
1411
+
1412
+
1413
+	/**
1414
+	 * Makes sure the 3.1's image url is converted to an image attachment post to the 4.1 CPT event
1415
+	 * and sets it as the featured image on the CPT event
1416
+	 *
1417
+	 * @param type                            $old_event
1418
+	 * @param type                            $new_cpt_id
1419
+	 * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1420
+	 * @return boolean whether or not we had to do the big job of creating an image attachment
1421
+	 */
1422
+	public function convert_image_url_to_attachment_and_attach_to_post(
1423
+			$guid,
1424
+			$new_cpt_id,
1425
+			EE_Data_Migration_Script_Stage $migration_stage
1426
+	) {
1427
+		$created_attachment_post = false;
1428
+		$guid = $this->_get_original_guid($guid);
1429
+		if ($guid) {
1430
+			//check for an existing attachment post with this guid
1431
+			$attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1432
+			if ( ! $attachment_post_id) {
1433
+				//post thumbnail with that GUID doesn't exist, we should create one
1434
+				$attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1435
+				$created_attachment_post = true;
1436
+			}
1437
+			//double-check we actually have an attachment post
1438
+			if ($attachment_post_id) {
1439
+				update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1440
+			} else {
1441
+				$migration_stage->add_error(sprintf(esc_html__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d",
1442
+						"event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1443
+			}
1444
+		}
1445
+		return $created_attachment_post;
1446
+	}
1447
+
1448
+
1449
+
1450
+	/**
1451
+	 * In 3.1, the event thumbnail image DOESN'T point to the orignal image, but instead
1452
+	 * to a large thumbnail (which has nearly the same GUID, except it adds "-{width}x{height}" before the filetype,
1453
+	 * or whatever dimensions it is. Eg 'http://mysite.com/image1-300x400.jpg' instead of
1454
+	 * 'http://mysite.com/image1.jpg' ). This function attempts to strip that off and get the original file, if it
1455
+	 * exists
1456
+	 *
1457
+	 * @param string $guid_in_old_event
1458
+	 * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1459
+	 */
1460
+	private function _get_original_guid($guid_in_old_event)
1461
+	{
1462
+		$original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1463
+		//do a head request to verify the file exists
1464
+		$head_response = wp_remote_head($original_guid);
1465
+		if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1466
+			return $original_guid;
1467
+		} else {
1468
+			return $guid_in_old_event;
1469
+		}
1470
+	}
1471
+
1472
+
1473
+
1474
+	/**
1475
+	 * Creates an image attachment post for the GUID. If the GUID points to a remote image,
1476
+	 * we download it to our uploads directory so that it can be properly processed (eg, creates different sizes of
1477
+	 * thumbnails)
1478
+	 *
1479
+	 * @param type                           $guid
1480
+	 * @param EE_Data_Migration_Script_Stage $migration_stage
1481
+	 * @return int
1482
+	 */
1483
+	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage)
1484
+	{
1485
+		if ( ! $guid) {
1486
+			$migration_stage->add_error(sprintf(esc_html__("Cannot create image attachment for a blank GUID!",
1487
+					"event_espresso")));
1488
+			return 0;
1489
+		}
1490
+		$wp_filetype = wp_check_filetype(basename($guid), null);
1491
+		$wp_upload_dir = wp_upload_dir();
1492
+		//if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1493
+		if (strpos($guid, $wp_upload_dir['url']) === false) {
1494
+			//image is located remotely. download it and place it in the uploads directory
1495
+			if ( ! is_readable($guid)) {
1496
+				$migration_stage->add_error(sprintf(esc_html__("Could not create image attachment from non-existent file: %s",
1497
+						"event_espresso"), $guid));
1498
+				return 0;
1499
+			}
1500
+			$contents = file_get_contents($guid);
1501
+			if ($contents === false) {
1502
+				$migration_stage->add_error(sprintf(esc_html__("Could not read image at %s, and therefore couldnt create an attachment post for it.",
1503
+						"event_espresso"), $guid));
1504
+				return false;
1505
+			}
1506
+			$local_filepath = $wp_upload_dir['path'] . DS . basename($guid);
1507
+			$savefile = fopen($local_filepath, 'w');
1508
+			fwrite($savefile, $contents);
1509
+			fclose($savefile);
1510
+			$guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1511
+		} else {
1512
+			$local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1513
+		}
1514
+		$attachment = array(
1515
+				'guid'           => $guid,
1516
+				'post_mime_type' => $wp_filetype['type'],
1517
+				'post_title'     => preg_replace('/\.[^.]+$/', '', basename($guid)),
1518
+				'post_content'   => '',
1519
+				'post_status'    => 'inherit',
1520
+		);
1521
+		$attach_id = wp_insert_attachment($attachment, $guid);
1522
+		if ( ! $attach_id) {
1523
+			$migration_stage->add_error(sprintf(esc_html__("Could not create image attachment post from image '%s'. Attachment data was %s.",
1524
+					"event_espresso"), $guid, $this->_json_encode($attachment)));
1525
+			return $attach_id;
1526
+		}
1527
+		// you must first include the image.php file
1528
+		// for the function wp_generate_attachment_metadata() to work
1529
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1530
+		$attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1531
+		if ( ! $attach_data) {
1532
+			$migration_stage->add_error(sprintf(esc_html__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.",
1533
+					"event_espresso"), $attach_id, $local_filepath, $guid));
1534
+			return $attach_id;
1535
+		}
1536
+		$metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1537
+		if ( ! $metadata_save_result) {
1538
+			$migration_stage->add_error(sprintf(esc_html__("Could not update attachment metadata for attachment %d with data %s",
1539
+					"event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1540
+		}
1541
+		return $attach_id;
1542
+	}
1543
+
1544
+
1545
+
1546
+	/**
1547
+	 * Finds the attachment post containing info about an image attachment given the GUID (link to the image itself),
1548
+	 * and returns its ID.
1549
+	 *
1550
+	 * @global type  $wpdb
1551
+	 * @param string $guid
1552
+	 * @return int
1553
+	 */
1554
+	private function _get_image_attachment_id_by_GUID($guid)
1555
+	{
1556
+		global $wpdb;
1557
+		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1558
+		return $attachment_id;
1559
+	}
1560
+
1561
+
1562
+
1563
+	/**
1564
+	 * Returns a mysql-formatted DATETIME in UTC time, given a $DATETIME_string
1565
+	 * (and optionally a timezone; if none is given, the wp DEFAULT is used)
1566
+	 *
1567
+	 * @param EE_Data_Migration_Script_base $stage
1568
+	 * @param array                         $row_of_data , the row from the DB (as an array) we're trying to find the
1569
+	 *                                                   UTC time for
1570
+	 * @param string                        $DATETIME_string
1571
+	 * @param string                        $timezone
1572
+	 * @return string
1573
+	 */
1574
+	public function convert_date_string_to_utc(
1575
+			EE_Data_Migration_Script_Stage $stage,
1576
+			$row_of_data,
1577
+			$DATETIME_string,
1578
+			$timezone = null
1579
+	) {
1580
+		$original_tz = $timezone;
1581
+		if ( ! $timezone) {
1582
+			$timezone = $this->_get_wp_timezone();
1583
+		}
1584
+		if ( ! $timezone) {
1585
+			$stage->add_error(sprintf(esc_html__("Could not find timezone given %s for %s", "event_espresso"), $original_tz,
1586
+					$row_of_data));
1587
+			$timezone = 'UTC';
1588
+		}
1589
+		try {
1590
+			$date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1591
+			EEH_DTT_Helper::setTimezone($date_obj, new DateTimeZone('UTC'));
1592
+		} catch (Exception $e) {
1593
+			$stage->add_error(sprintf(esc_html__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.",
1594
+					"event_espresso"), $DATETIME_string, $timezone));
1595
+			$date_obj = new DateTime();
1596
+		}
1597
+		return $date_obj->format('Y-m-d H:i:s');
1598
+	}
1599
+
1600
+
1601
+
1602
+	/**
1603
+	 * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1604
+	 *
1605
+	 * @return string
1606
+	 */
1607
+	private function _get_wp_timezone()
1608
+	{
1609
+		$timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1610
+		//if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1611
+		if (empty($timezone)) {
1612
+			//let's get a the WordPress UTC offset
1613
+			$offset = get_option('gmt_offset');
1614
+			$timezone = $this->timezone_convert_to_string_from_offset($offset);
1615
+		}
1616
+		return $timezone;
1617
+	}
1618
+
1619
+
1620
+
1621
+	/**
1622
+	 * Gets the wordpress timezone string from a UTC offset
1623
+	 *
1624
+	 * @param int $offset
1625
+	 * @return boolean
1626
+	 */
1627
+	private function timezone_convert_to_string_from_offset($offset)
1628
+	{
1629
+		//shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
1630
+		$offset *= 3600; // convert hour offset to seconds
1631
+		$abbrarray = timezone_abbreviations_list();
1632
+		foreach ($abbrarray as $abbr) {
1633
+			foreach ($abbr as $city) {
1634
+				if ($city['offset'] == $offset) {
1635
+					return $city['timezone_id'];
1636
+				}
1637
+			}
1638
+		}
1639
+		return false;
1640
+	}
1641
+
1642
+
1643
+
1644
+	public function migration_page_hooks()
1645
+	{
1646
+		add_filter(
1647
+				'FHEE__ee_migration_page__header',
1648
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1649
+				10,
1650
+				3
1651
+		);
1652
+		add_filter(
1653
+				'FHEE__ee_migration_page__p_after_header',
1654
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1655
+				10,
1656
+				2
1657
+		);
1658
+		add_filter(
1659
+				'FHEE__ee_migration_page__option_1_main',
1660
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1661
+				10,
1662
+				3
1663
+		);
1664
+		add_filter(
1665
+				'FHEE__ee_migration_page__option_1_button_text',
1666
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1667
+				10,
1668
+				3
1669
+		);
1670
+		add_action(
1671
+				'AHEE__ee_migration_page__option_1_extra_details',
1672
+				array($this, '_migration_page_hook_option_1_extra_details'),
1673
+				10,
1674
+				3
1675
+		);
1676
+		add_filter(
1677
+				'FHEE__ee_migration_page__option_2_main',
1678
+				array($this, '_migrate_page_hook_simplify_version_strings'),
1679
+				10,
1680
+				4
1681
+		);
1682
+		add_filter(
1683
+				'FHEE__ee_migration_page__option_2_button_text',
1684
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1685
+				10,
1686
+				2
1687
+		);
1688
+		add_filter(
1689
+				'FHEE__ee_migration_page__option_2_details',
1690
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1691
+				10,
1692
+				2
1693
+		);
1694
+		add_action(
1695
+				'AHEE__ee_migration_page__after_migration_options_table',
1696
+				array($this, '_migration_page_hook_after_migration_options_table')
1697
+		);
1698
+		add_filter(
1699
+				'FHEE__ee_migration_page__done_migration_header',
1700
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1701
+				10,
1702
+				2
1703
+		);
1704
+		add_filter(
1705
+				'FHEE__ee_migration_page__p_after_done_migration_header',
1706
+				array($this, '_migration_page_hook_simplify_next_db_state'),
1707
+				10,
1708
+				2
1709
+		);
1710
+		add_filter(
1711
+				'FHEE__ee_migration_page__migration_options_template',
1712
+				array($this,'use_migration_options_from_ee3_template')
1713
+		);
1714
+	}
1715
+
1716
+
1717
+
1718
+	public function _migrate_page_hook_simplify_version_strings(
1719
+			$old_content,
1720
+			$current_db_state,
1721
+			$next_db_state,
1722
+			$ultimate_db_state = null
1723
+	) {
1724
+		return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state),
1725
+				array(esc_html__('EE3', 'event_espresso'), esc_html__('EE4', 'event_espresso'), esc_html__("EE4", 'event_espresso')),
1726
+				$old_content);
1727
+	}
1728
+
1729
+
1730
+
1731
+	public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state)
1732
+	{
1733
+		return str_replace($next_db_state, esc_html__("EE4", 'event_espresso'), $old_content);
1734
+	}
1735
+
1736
+
1737
+
1738
+	public function _migration_page_hook_option_1_extra_details()
1739
+	{
1740
+		?>
1741 1741
         <p><?php printf(esc_html__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents",
1742
-            "event_espresso")); ?></p><?php
1743
-    }
1742
+			"event_espresso")); ?></p><?php
1743
+	}
1744 1744
 
1745 1745
 
1746 1746
 
1747
-    public function _migration_page_hook_after_migration_options_table()
1748
-    {
1749
-        ?><p class="ee-attention">
1747
+	public function _migration_page_hook_after_migration_options_table()
1748
+	{
1749
+		?><p class="ee-attention">
1750 1750
         <strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ",
1751
-                        "event_espresso"); ?></span></strong>
1751
+						"event_espresso"); ?></span></strong>
1752 1752
         <br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.",
1753
-            "event_espresso"); ?>
1753
+			"event_espresso"); ?>
1754 1754
         </p><?php
1755
-    }
1755
+	}
1756 1756
 
1757 1757
 
1758 1758
 
1759
-    /**
1760
-     * When showing the migration options, show more options and info than normal (ie, give folks the option
1761
-     * to start using EE4 without migrating. From EE3 that's fine, because it doesn't actually remove any data, because
1762
-     * EE4 doesn't have any yet. But when migrating from EE4 it would remove old data, so its not a great idea).
1763
-     * @param $template_filepath
1764
-     * @return string
1765
-     */
1766
-    public function use_migration_options_from_ee3_template( $template_filepath ) {
1767
-        return EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee3.template.php';
1768
-    }
1759
+	/**
1760
+	 * When showing the migration options, show more options and info than normal (ie, give folks the option
1761
+	 * to start using EE4 without migrating. From EE3 that's fine, because it doesn't actually remove any data, because
1762
+	 * EE4 doesn't have any yet. But when migrating from EE4 it would remove old data, so its not a great idea).
1763
+	 * @param $template_filepath
1764
+	 * @return string
1765
+	 */
1766
+	public function use_migration_options_from_ee3_template( $template_filepath ) {
1767
+		return EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee3.template.php';
1768
+	}
1769 1769
 }
Please login to merge, or discard this patch.