Completed
Branch BUG/3575-event-deletion-previe... (bbeda1)
by
unknown
06:40 queued 04:49
created
core/domain/services/validation/email/strategies/InternationalDNS.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -15,43 +15,43 @@
 block discarded – undo
15 15
 class InternationalDNS extends International
16 16
 {
17 17
 
18
-    /**
19
-     * Validates the email in teh same way as the parent, but also
20
-     * verifies the domain exists.
21
-     *
22
-     * @param string $email_address
23
-     * @return bool
24
-     * @throws EmailValidationException
25
-     */
26
-    public function validate($email_address)
27
-    {
28
-        parent::validate($email_address);
29
-        $domain = $this->getDomainPartOfEmail(
30
-            $email_address,
31
-            $this->getAtIndex($email_address)
32
-        );
33
-        if (! checkdnsrr($domain, 'MX')) {
34
-            // domain not found in MX records
35
-            throw new EmailValidationException(
36
-                esc_html__(
37
-                // @codingStandardsIgnoreStart
38
-                    'Although the email address provided is formatted correctly, a valid "MX record" could not be located for that address and domain. Please enter a valid email address.',
39
-                    // @codingStandardsIgnoreEnd
40
-                    'event_espresso'
41
-                )
42
-            );
43
-        }
44
-        if (! checkdnsrr($domain, 'A')) {
45
-            // domain not found in A records
46
-            throw new EmailValidationException(
47
-                esc_html__(
48
-                // @codingStandardsIgnoreStart
49
-                    'Although the email address provided is formatted correctly, a valid "A record" could not be located for that address and domain. Please enter a valid email address.',
50
-                    // @codingStandardsIgnoreEnd
51
-                    'event_espresso'
52
-                )
53
-            );
54
-        }
55
-        return true;
56
-    }
18
+	/**
19
+	 * Validates the email in teh same way as the parent, but also
20
+	 * verifies the domain exists.
21
+	 *
22
+	 * @param string $email_address
23
+	 * @return bool
24
+	 * @throws EmailValidationException
25
+	 */
26
+	public function validate($email_address)
27
+	{
28
+		parent::validate($email_address);
29
+		$domain = $this->getDomainPartOfEmail(
30
+			$email_address,
31
+			$this->getAtIndex($email_address)
32
+		);
33
+		if (! checkdnsrr($domain, 'MX')) {
34
+			// domain not found in MX records
35
+			throw new EmailValidationException(
36
+				esc_html__(
37
+				// @codingStandardsIgnoreStart
38
+					'Although the email address provided is formatted correctly, a valid "MX record" could not be located for that address and domain. Please enter a valid email address.',
39
+					// @codingStandardsIgnoreEnd
40
+					'event_espresso'
41
+				)
42
+			);
43
+		}
44
+		if (! checkdnsrr($domain, 'A')) {
45
+			// domain not found in A records
46
+			throw new EmailValidationException(
47
+				esc_html__(
48
+				// @codingStandardsIgnoreStart
49
+					'Although the email address provided is formatted correctly, a valid "A record" could not be located for that address and domain. Please enter a valid email address.',
50
+					// @codingStandardsIgnoreEnd
51
+					'event_espresso'
52
+				)
53
+			);
54
+		}
55
+		return true;
56
+	}
57 57
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $email_address,
31 31
             $this->getAtIndex($email_address)
32 32
         );
33
-        if (! checkdnsrr($domain, 'MX')) {
33
+        if ( ! checkdnsrr($domain, 'MX')) {
34 34
             // domain not found in MX records
35 35
             throw new EmailValidationException(
36 36
                 esc_html__(
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                 )
42 42
             );
43 43
         }
44
-        if (! checkdnsrr($domain, 'A')) {
44
+        if ( ! checkdnsrr($domain, 'A')) {
45 45
             // domain not found in A records
46 46
             throw new EmailValidationException(
47 47
                 esc_html__(
Please login to merge, or discard this patch.
core/EE_Module_Request_Router.core.php 2 patches
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -16,254 +16,254 @@
 block discarded – undo
16 16
 final class EE_Module_Request_Router implements InterminableInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @var RequestInterface $request
21
-     */
22
-    private $request;
19
+	/**
20
+	 * @var RequestInterface $request
21
+	 */
22
+	private $request;
23 23
 
24
-    /**
25
-     * @var array $_previous_routes
26
-     */
27
-    private static $_previous_routes = array();
24
+	/**
25
+	 * @var array $_previous_routes
26
+	 */
27
+	private static $_previous_routes = array();
28 28
 
29
-    /**
30
-     * @var WP_Query $WP_Query
31
-     */
32
-    public $WP_Query;
29
+	/**
30
+	 * @var WP_Query $WP_Query
31
+	 */
32
+	public $WP_Query;
33 33
 
34 34
 
35
-    /**
36
-     * EE_Module_Request_Router constructor.
37
-     *
38
-     * @param RequestInterface $request
39
-     */
40
-    public function __construct(RequestInterface $request)
41
-    {
42
-        $this->request = $request;
43
-    }
35
+	/**
36
+	 * EE_Module_Request_Router constructor.
37
+	 *
38
+	 * @param RequestInterface $request
39
+	 */
40
+	public function __construct(RequestInterface $request)
41
+	{
42
+		$this->request = $request;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * on the first call  to this method, it checks the Request for a "route"
48
-     * on subsequent calls to this method,
49
-     * instead of checking the Request for a route, it checks the previous routes array,
50
-     * and checks if the last called route has any forwarding routes registered for it
51
-     *
52
-     * @param WP_Query $WP_Query
53
-     * @return NULL|string
54
-     * @throws EE_Error
55
-     * @throws ReflectionException
56
-     */
57
-    public function get_route(WP_Query $WP_Query)
58
-    {
59
-        $this->WP_Query = $WP_Query;
60
-        // assume this if first route being called
61
-        $previous_route = false;
62
-        // but is it really ???
63
-        if (! empty(self::$_previous_routes)) {
64
-            // get last run route
65
-            $previous_routes = array_values(self::$_previous_routes);
66
-            $previous_route = array_pop($previous_routes);
67
-        }
68
-        //  has another route already been run ?
69
-        if ($previous_route) {
70
-            // check if  forwarding has been set
71
-            $current_route = $this->get_forward($previous_route);
72
-            try {
73
-                // check for recursive forwarding
74
-                if (isset(self::$_previous_routes[ $current_route ])) {
75
-                    throw new EE_Error(
76
-                        sprintf(
77
-                            esc_html__(
78
-                                'An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.',
79
-                                'event_espresso'
80
-                            ),
81
-                            $current_route
82
-                        )
83
-                    );
84
-                }
85
-            } catch (EE_Error $e) {
86
-                $e->get_error();
87
-                return null;
88
-            }
89
-        } else {
90
-            // first route called
91
-            $current_route = null;
92
-            // grab all routes
93
-            $routes = EE_Config::get_routes();
94
-            foreach ($routes as $key => $route) {
95
-                // first determine if route key uses w?ldc*rds
96
-                $uses_wildcards = strpos($key, '?') !== false
97
-                                  || strpos($key, '*') !== false;
98
-                // check request for module route
99
-                $route_found = $uses_wildcards
100
-                    ? $this->request->matches($key)
101
-                    : $this->request->requestParamIsSet($key);
102
-                if ($route_found) {
103
-                    $current_route = $uses_wildcards
104
-                        ? $this->request->getMatch($key)
105
-                        : $this->request->getRequestParam($key);
106
-                    $current_route = sanitize_text_field($current_route);
107
-                    if ($current_route) {
108
-                        $current_route = array($key, $current_route);
109
-                        break;
110
-                    }
111
-                }
112
-            }
113
-        }
114
-        // sorry, but I can't read what you route !
115
-        if (empty($current_route)) {
116
-            return null;
117
-        }
118
-        // add route to previous routes array
119
-        self::$_previous_routes[] = $current_route;
120
-        return $current_route;
121
-    }
46
+	/**
47
+	 * on the first call  to this method, it checks the Request for a "route"
48
+	 * on subsequent calls to this method,
49
+	 * instead of checking the Request for a route, it checks the previous routes array,
50
+	 * and checks if the last called route has any forwarding routes registered for it
51
+	 *
52
+	 * @param WP_Query $WP_Query
53
+	 * @return NULL|string
54
+	 * @throws EE_Error
55
+	 * @throws ReflectionException
56
+	 */
57
+	public function get_route(WP_Query $WP_Query)
58
+	{
59
+		$this->WP_Query = $WP_Query;
60
+		// assume this if first route being called
61
+		$previous_route = false;
62
+		// but is it really ???
63
+		if (! empty(self::$_previous_routes)) {
64
+			// get last run route
65
+			$previous_routes = array_values(self::$_previous_routes);
66
+			$previous_route = array_pop($previous_routes);
67
+		}
68
+		//  has another route already been run ?
69
+		if ($previous_route) {
70
+			// check if  forwarding has been set
71
+			$current_route = $this->get_forward($previous_route);
72
+			try {
73
+				// check for recursive forwarding
74
+				if (isset(self::$_previous_routes[ $current_route ])) {
75
+					throw new EE_Error(
76
+						sprintf(
77
+							esc_html__(
78
+								'An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.',
79
+								'event_espresso'
80
+							),
81
+							$current_route
82
+						)
83
+					);
84
+				}
85
+			} catch (EE_Error $e) {
86
+				$e->get_error();
87
+				return null;
88
+			}
89
+		} else {
90
+			// first route called
91
+			$current_route = null;
92
+			// grab all routes
93
+			$routes = EE_Config::get_routes();
94
+			foreach ($routes as $key => $route) {
95
+				// first determine if route key uses w?ldc*rds
96
+				$uses_wildcards = strpos($key, '?') !== false
97
+								  || strpos($key, '*') !== false;
98
+				// check request for module route
99
+				$route_found = $uses_wildcards
100
+					? $this->request->matches($key)
101
+					: $this->request->requestParamIsSet($key);
102
+				if ($route_found) {
103
+					$current_route = $uses_wildcards
104
+						? $this->request->getMatch($key)
105
+						: $this->request->getRequestParam($key);
106
+					$current_route = sanitize_text_field($current_route);
107
+					if ($current_route) {
108
+						$current_route = array($key, $current_route);
109
+						break;
110
+					}
111
+				}
112
+			}
113
+		}
114
+		// sorry, but I can't read what you route !
115
+		if (empty($current_route)) {
116
+			return null;
117
+		}
118
+		// add route to previous routes array
119
+		self::$_previous_routes[] = $current_route;
120
+		return $current_route;
121
+	}
122 122
 
123 123
 
124
-    /**
125
-     * this method simply takes a valid route, and resolves what module class method the route points to
126
-     *
127
-     * @param string $key
128
-     * @param string $current_route
129
-     * @return EED_Module|object|boolean|null
130
-     * @throws EE_Error
131
-     * @throws ReflectionException
132
-     */
133
-    public function resolve_route($key, $current_route)
134
-    {
135
-        // get module method that route has been mapped to
136
-        $module_method = EE_Config::get_route($current_route, $key);
137
-        // verify result was returned
138
-        if (empty($module_method)) {
139
-            $msg = sprintf(
140
-                esc_html__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'),
141
-                $current_route
142
-            );
143
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
144
-            return false;
145
-        }
146
-        // verify that result is an array
147
-        if (! is_array($module_method)) {
148
-            $msg = sprintf(esc_html__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
149
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
150
-            return false;
151
-        }
152
-        // grab module name
153
-        $module_name = $module_method[0];
154
-        // verify that a class method was registered properly
155
-        if (! isset($module_method[1])) {
156
-            $msg = sprintf(
157
-                esc_html__('A class method for the %s  route has not been properly registered.', 'event_espresso'),
158
-                $current_route
159
-            );
160
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
161
-            return false;
162
-        }
163
-        // grab method
164
-        $method = $module_method[1];
165
-        // verify that class exists
166
-        if (! class_exists($module_name)) {
167
-            $msg = sprintf(esc_html__('The requested %s class could not be found.', 'event_espresso'), $module_name);
168
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
169
-            return false;
170
-        }
171
-        // verify that method exists
172
-        if (! method_exists($module_name, $method)) {
173
-            $msg = sprintf(
174
-                esc_html__('The class method %s for the %s route is in invalid.', 'event_espresso'),
175
-                $method,
176
-                $current_route
177
-            );
178
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
179
-            return false;
180
-        }
181
-        // instantiate module and call route method
182
-        return $this->_module_router($module_name, $method);
183
-    }
124
+	/**
125
+	 * this method simply takes a valid route, and resolves what module class method the route points to
126
+	 *
127
+	 * @param string $key
128
+	 * @param string $current_route
129
+	 * @return EED_Module|object|boolean|null
130
+	 * @throws EE_Error
131
+	 * @throws ReflectionException
132
+	 */
133
+	public function resolve_route($key, $current_route)
134
+	{
135
+		// get module method that route has been mapped to
136
+		$module_method = EE_Config::get_route($current_route, $key);
137
+		// verify result was returned
138
+		if (empty($module_method)) {
139
+			$msg = sprintf(
140
+				esc_html__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'),
141
+				$current_route
142
+			);
143
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
144
+			return false;
145
+		}
146
+		// verify that result is an array
147
+		if (! is_array($module_method)) {
148
+			$msg = sprintf(esc_html__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
149
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
150
+			return false;
151
+		}
152
+		// grab module name
153
+		$module_name = $module_method[0];
154
+		// verify that a class method was registered properly
155
+		if (! isset($module_method[1])) {
156
+			$msg = sprintf(
157
+				esc_html__('A class method for the %s  route has not been properly registered.', 'event_espresso'),
158
+				$current_route
159
+			);
160
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
161
+			return false;
162
+		}
163
+		// grab method
164
+		$method = $module_method[1];
165
+		// verify that class exists
166
+		if (! class_exists($module_name)) {
167
+			$msg = sprintf(esc_html__('The requested %s class could not be found.', 'event_espresso'), $module_name);
168
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
169
+			return false;
170
+		}
171
+		// verify that method exists
172
+		if (! method_exists($module_name, $method)) {
173
+			$msg = sprintf(
174
+				esc_html__('The class method %s for the %s route is in invalid.', 'event_espresso'),
175
+				$method,
176
+				$current_route
177
+			);
178
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
179
+			return false;
180
+		}
181
+		// instantiate module and call route method
182
+		return $this->_module_router($module_name, $method);
183
+	}
184 184
 
185 185
 
186
-    /**
187
-     * this method instantiates modules and calls the method that was defined when the route was registered
188
-     *
189
-     * @param string $module_name
190
-     * @return EED_Module|object|null
191
-     */
192
-    public static function module_factory($module_name)
193
-    {
194
-        if ($module_name === 'EED_Module') {
195
-            EE_Error::add_error(
196
-                sprintf(
197
-                    esc_html__(
198
-                        'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.',
199
-                        'event_espresso'
200
-                    ),
201
-                    $module_name
202
-                ),
203
-                __FILE__,
204
-                __FUNCTION__,
205
-                __LINE__
206
-            );
207
-            return null;
208
-        }
209
-        // instantiate module class
210
-        $module = new $module_name();
211
-        // ensure that class is actually a module
212
-        if (! $module instanceof EED_Module) {
213
-            EE_Error::add_error(
214
-                sprintf(esc_html__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name),
215
-                __FILE__,
216
-                __FUNCTION__,
217
-                __LINE__
218
-            );
219
-            return null;
220
-        }
221
-        return $module;
222
-    }
186
+	/**
187
+	 * this method instantiates modules and calls the method that was defined when the route was registered
188
+	 *
189
+	 * @param string $module_name
190
+	 * @return EED_Module|object|null
191
+	 */
192
+	public static function module_factory($module_name)
193
+	{
194
+		if ($module_name === 'EED_Module') {
195
+			EE_Error::add_error(
196
+				sprintf(
197
+					esc_html__(
198
+						'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.',
199
+						'event_espresso'
200
+					),
201
+					$module_name
202
+				),
203
+				__FILE__,
204
+				__FUNCTION__,
205
+				__LINE__
206
+			);
207
+			return null;
208
+		}
209
+		// instantiate module class
210
+		$module = new $module_name();
211
+		// ensure that class is actually a module
212
+		if (! $module instanceof EED_Module) {
213
+			EE_Error::add_error(
214
+				sprintf(esc_html__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name),
215
+				__FILE__,
216
+				__FUNCTION__,
217
+				__LINE__
218
+			);
219
+			return null;
220
+		}
221
+		return $module;
222
+	}
223 223
 
224 224
 
225
-    /**
226
-     * this method instantiates modules and calls the method that was defined when the route was registered
227
-     *
228
-     * @param string $module_name
229
-     * @param string $method
230
-     * @return EED_Module|null
231
-     * @throws EE_Error
232
-     * @throws ReflectionException
233
-     */
234
-    private function _module_router($module_name, $method)
235
-    {
236
-        // instantiate module class
237
-        $module = EE_Module_Request_Router::module_factory($module_name);
238
-        if ($module instanceof EED_Module) {
239
-            // and call whatever action the route was for
240
-            try {
241
-                $module->{$method}($this->WP_Query);
242
-            } catch (EE_Error $e) {
243
-                $e->get_error();
244
-                return null;
245
-            }
246
-        }
247
-        return $module;
248
-    }
225
+	/**
226
+	 * this method instantiates modules and calls the method that was defined when the route was registered
227
+	 *
228
+	 * @param string $module_name
229
+	 * @param string $method
230
+	 * @return EED_Module|null
231
+	 * @throws EE_Error
232
+	 * @throws ReflectionException
233
+	 */
234
+	private function _module_router($module_name, $method)
235
+	{
236
+		// instantiate module class
237
+		$module = EE_Module_Request_Router::module_factory($module_name);
238
+		if ($module instanceof EED_Module) {
239
+			// and call whatever action the route was for
240
+			try {
241
+				$module->{$method}($this->WP_Query);
242
+			} catch (EE_Error $e) {
243
+				$e->get_error();
244
+				return null;
245
+			}
246
+		}
247
+		return $module;
248
+	}
249 249
 
250 250
 
251
-    /**
252
-     * @param $current_route
253
-     * @return string
254
-     */
255
-    public function get_forward($current_route)
256
-    {
257
-        return EE_Config::get_forward($current_route);
258
-    }
251
+	/**
252
+	 * @param $current_route
253
+	 * @return string
254
+	 */
255
+	public function get_forward($current_route)
256
+	{
257
+		return EE_Config::get_forward($current_route);
258
+	}
259 259
 
260 260
 
261
-    /**
262
-     * @param $current_route
263
-     * @return string
264
-     */
265
-    public function get_view($current_route)
266
-    {
267
-        return EE_Config::get_view($current_route);
268
-    }
261
+	/**
262
+	 * @param $current_route
263
+	 * @return string
264
+	 */
265
+	public function get_view($current_route)
266
+	{
267
+		return EE_Config::get_view($current_route);
268
+	}
269 269
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         // assume this if first route being called
61 61
         $previous_route = false;
62 62
         // but is it really ???
63
-        if (! empty(self::$_previous_routes)) {
63
+        if ( ! empty(self::$_previous_routes)) {
64 64
             // get last run route
65 65
             $previous_routes = array_values(self::$_previous_routes);
66 66
             $previous_route = array_pop($previous_routes);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $current_route = $this->get_forward($previous_route);
72 72
             try {
73 73
                 // check for recursive forwarding
74
-                if (isset(self::$_previous_routes[ $current_route ])) {
74
+                if (isset(self::$_previous_routes[$current_route])) {
75 75
                     throw new EE_Error(
76 76
                         sprintf(
77 77
                             esc_html__(
@@ -144,38 +144,38 @@  discard block
 block discarded – undo
144 144
             return false;
145 145
         }
146 146
         // verify that result is an array
147
-        if (! is_array($module_method)) {
147
+        if ( ! is_array($module_method)) {
148 148
             $msg = sprintf(esc_html__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
149
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
149
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
150 150
             return false;
151 151
         }
152 152
         // grab module name
153 153
         $module_name = $module_method[0];
154 154
         // verify that a class method was registered properly
155
-        if (! isset($module_method[1])) {
155
+        if ( ! isset($module_method[1])) {
156 156
             $msg = sprintf(
157 157
                 esc_html__('A class method for the %s  route has not been properly registered.', 'event_espresso'),
158 158
                 $current_route
159 159
             );
160
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
160
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
161 161
             return false;
162 162
         }
163 163
         // grab method
164 164
         $method = $module_method[1];
165 165
         // verify that class exists
166
-        if (! class_exists($module_name)) {
166
+        if ( ! class_exists($module_name)) {
167 167
             $msg = sprintf(esc_html__('The requested %s class could not be found.', 'event_espresso'), $module_name);
168 168
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
169 169
             return false;
170 170
         }
171 171
         // verify that method exists
172
-        if (! method_exists($module_name, $method)) {
172
+        if ( ! method_exists($module_name, $method)) {
173 173
             $msg = sprintf(
174 174
                 esc_html__('The class method %s for the %s route is in invalid.', 'event_espresso'),
175 175
                 $method,
176 176
                 $current_route
177 177
             );
178
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
178
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
179 179
             return false;
180 180
         }
181 181
         // instantiate module and call route method
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         // instantiate module class
210 210
         $module = new $module_name();
211 211
         // ensure that class is actually a module
212
-        if (! $module instanceof EED_Module) {
212
+        if ( ! $module instanceof EED_Module) {
213 213
             EE_Error::add_error(
214 214
                 sprintf(esc_html__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name),
215 215
                 __FILE__,
Please login to merge, or discard this patch.
core/EE_Deprecated.core.php 2 patches
Indentation   +1217 added lines, -1217 removed lines patch added patch discarded remove patch
@@ -39,31 +39,31 @@  discard block
 block discarded – undo
39 39
  * @param string $action_or_filter
40 40
  */
41 41
 function deprecated_espresso_action_or_filter_doing_it_wrong(
42
-    $deprecated_filter,
43
-    $replacement,
44
-    $replacement_location,
45
-    $version_deprecated,
46
-    $version_applies,
47
-    $action_or_filter = 'action'
42
+	$deprecated_filter,
43
+	$replacement,
44
+	$replacement_location,
45
+	$version_deprecated,
46
+	$version_applies,
47
+	$action_or_filter = 'action'
48 48
 ) {
49
-    $action_or_filter = $action_or_filter === 'action'
50
-        ? esc_html__('action', 'event_espresso')
51
-        : esc_html__('filter', 'event_espresso');
52
-    EE_Error::doing_it_wrong(
53
-        $deprecated_filter,
54
-        sprintf(
55
-            esc_html__(
56
-                'This %1$s is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"',
57
-                'event_espresso'
58
-            ),
59
-            $action_or_filter,
60
-            $replacement,
61
-            $replacement_location,
62
-            '<br />'
63
-        ),
64
-        $version_deprecated,
65
-        $version_applies
66
-    );
49
+	$action_or_filter = $action_or_filter === 'action'
50
+		? esc_html__('action', 'event_espresso')
51
+		: esc_html__('filter', 'event_espresso');
52
+	EE_Error::doing_it_wrong(
53
+		$deprecated_filter,
54
+		sprintf(
55
+			esc_html__(
56
+				'This %1$s is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"',
57
+				'event_espresso'
58
+			),
59
+			$action_or_filter,
60
+			$replacement,
61
+			$replacement_location,
62
+			'<br />'
63
+		),
64
+		$version_deprecated,
65
+		$version_applies
66
+	);
67 67
 }
68 68
 
69 69
 /**
@@ -75,90 +75,90 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout)
77 77
 {
78
-    // list of old filters
79
-    $deprecated_filters = array(
80
-        'update_registration_details' => true,
81
-        'process_payment'             => true,
82
-        'finalize_registration'       => true,
83
-        'and_proceed_to_payment'      => true,
84
-        'proceed_to'                  => true,
85
-    );
86
-    // loop thru and call doing_it_wrong() or remove any that aren't being used
87
-    foreach ($deprecated_filters as $deprecated_filter => $on) {
88
-        // was this filter called ?
89
-        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
90
-            // only display doing_it_wrong() notice to Event Admins during non-AJAX requests
91
-            if (EE_Registry::instance()->CAP->current_user_can(
92
-                    'ee_read_ee',
93
-                    'hide_doing_it_wrong_for_deprecated_SPCO_filter'
94
-                ) && ! defined('DOING_AJAX')) {
95
-                EE_Error::doing_it_wrong(
96
-                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
97
-                    sprintf(
98
-                        esc_html__(
99
-                            'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"',
100
-                            'event_espresso'
101
-                        ),
102
-                        'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
103
-                        '<br />',
104
-                        'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
105
-                        '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
106
-                    ),
107
-                    '4.6.10'
108
-                );
109
-            }
110
-        } else {
111
-            unset($deprecated_filters[ $deprecated_filter ]);
112
-        }
113
-    }
114
-    if (! empty($deprecated_filters)) {
115
-
116
-        if ($checkout->current_step->slug(
117
-            ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
118
-            $submit_button_text = apply_filters(
119
-                'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details',
120
-                $submit_button_text
121
-            );
122
-        } elseif ($checkout->current_step->slug(
123
-            ) == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
124
-            $submit_button_text = apply_filters(
125
-                'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment',
126
-                $submit_button_text
127
-            );
128
-        } elseif ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug(
129
-            ) == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
130
-            $submit_button_text = apply_filters(
131
-                'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration',
132
-                $submit_button_text
133
-            );
134
-        }
135
-        if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
136
-            if ($checkout->payment_required() && $checkout->next_step->slug(
137
-                ) == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
138
-                $submit_button_text .= apply_filters(
139
-                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment',
140
-                    $submit_button_text
141
-                );
142
-            }
143
-            if ($checkout->next_step->slug(
144
-                ) != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
145
-                $submit_button_text = apply_filters(
146
-                                          'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to',
147
-                                          $submit_button_text
148
-                                      ) . $checkout->next_step->name();
149
-            }
150
-        }
151
-
152
-    }
153
-    return $submit_button_text;
78
+	// list of old filters
79
+	$deprecated_filters = array(
80
+		'update_registration_details' => true,
81
+		'process_payment'             => true,
82
+		'finalize_registration'       => true,
83
+		'and_proceed_to_payment'      => true,
84
+		'proceed_to'                  => true,
85
+	);
86
+	// loop thru and call doing_it_wrong() or remove any that aren't being used
87
+	foreach ($deprecated_filters as $deprecated_filter => $on) {
88
+		// was this filter called ?
89
+		if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
90
+			// only display doing_it_wrong() notice to Event Admins during non-AJAX requests
91
+			if (EE_Registry::instance()->CAP->current_user_can(
92
+					'ee_read_ee',
93
+					'hide_doing_it_wrong_for_deprecated_SPCO_filter'
94
+				) && ! defined('DOING_AJAX')) {
95
+				EE_Error::doing_it_wrong(
96
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
97
+					sprintf(
98
+						esc_html__(
99
+							'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"',
100
+							'event_espresso'
101
+						),
102
+						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
103
+						'<br />',
104
+						'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
105
+						'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
106
+					),
107
+					'4.6.10'
108
+				);
109
+			}
110
+		} else {
111
+			unset($deprecated_filters[ $deprecated_filter ]);
112
+		}
113
+	}
114
+	if (! empty($deprecated_filters)) {
115
+
116
+		if ($checkout->current_step->slug(
117
+			) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
118
+			$submit_button_text = apply_filters(
119
+				'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details',
120
+				$submit_button_text
121
+			);
122
+		} elseif ($checkout->current_step->slug(
123
+			) == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
124
+			$submit_button_text = apply_filters(
125
+				'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment',
126
+				$submit_button_text
127
+			);
128
+		} elseif ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug(
129
+			) == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
130
+			$submit_button_text = apply_filters(
131
+				'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration',
132
+				$submit_button_text
133
+			);
134
+		}
135
+		if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
136
+			if ($checkout->payment_required() && $checkout->next_step->slug(
137
+				) == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
138
+				$submit_button_text .= apply_filters(
139
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment',
140
+					$submit_button_text
141
+				);
142
+			}
143
+			if ($checkout->next_step->slug(
144
+				) != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
145
+				$submit_button_text = apply_filters(
146
+										  'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to',
147
+										  $submit_button_text
148
+									  ) . $checkout->next_step->name();
149
+			}
150
+		}
151
+
152
+	}
153
+	return $submit_button_text;
154 154
 
155 155
 }
156 156
 
157 157
 add_filter(
158
-    'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
159
-    'ee_deprecated__registration_checkout__button_text',
160
-    10,
161
-    2
158
+	'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
159
+	'ee_deprecated__registration_checkout__button_text',
160
+	10,
161
+	2
162 162
 );
163 163
 
164 164
 
@@ -170,54 +170,54 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates)
172 172
 {
173
-    $action_ref = null;
174
-    $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction')
175
-        ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
176
-    $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction')
177
-        ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
178
-    if ($action_ref) {
179
-
180
-        EE_Error::doing_it_wrong(
181
-            $action_ref,
182
-            sprintf(
183
-                esc_html__(
184
-                    'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"',
185
-                    'event_espresso'
186
-                ),
187
-                '<br />',
188
-                '/core/business/EE_Transaction_Processor.class.php',
189
-                'AHEE__EE_Transaction_Processor__finalize',
190
-                'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
191
-                'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events',
192
-                'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing'
193
-            ),
194
-            '4.6.0'
195
-        );
196
-        switch ($action_ref) {
197
-            case 'AHEE__EE_Transaction__finalize__new_transaction' :
198
-                do_action(
199
-                    'AHEE__EE_Transaction__finalize__new_transaction',
200
-                    $checkout->transaction,
201
-                    $checkout->admin_request
202
-                );
203
-                break;
204
-            case 'AHEE__EE_Transaction__finalize__all_transaction' :
205
-                do_action(
206
-                    'AHEE__EE_Transaction__finalize__new_transaction',
207
-                    $checkout->transaction,
208
-                    array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates),
209
-                    $checkout->admin_request
210
-                );
211
-                break;
212
-        }
213
-    }
173
+	$action_ref = null;
174
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction')
175
+		? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
176
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction')
177
+		? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
178
+	if ($action_ref) {
179
+
180
+		EE_Error::doing_it_wrong(
181
+			$action_ref,
182
+			sprintf(
183
+				esc_html__(
184
+					'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"',
185
+					'event_espresso'
186
+				),
187
+				'<br />',
188
+				'/core/business/EE_Transaction_Processor.class.php',
189
+				'AHEE__EE_Transaction_Processor__finalize',
190
+				'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
191
+				'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events',
192
+				'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing'
193
+			),
194
+			'4.6.0'
195
+		);
196
+		switch ($action_ref) {
197
+			case 'AHEE__EE_Transaction__finalize__new_transaction' :
198
+				do_action(
199
+					'AHEE__EE_Transaction__finalize__new_transaction',
200
+					$checkout->transaction,
201
+					$checkout->admin_request
202
+				);
203
+				break;
204
+			case 'AHEE__EE_Transaction__finalize__all_transaction' :
205
+				do_action(
206
+					'AHEE__EE_Transaction__finalize__new_transaction',
207
+					$checkout->transaction,
208
+					array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates),
209
+					$checkout->admin_request
210
+				);
211
+				break;
212
+		}
213
+	}
214 214
 }
215 215
 
216 216
 add_action(
217
-    'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed',
218
-    'ee_deprecated_finalize_transaction',
219
-    10,
220
-    2
217
+	'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed',
218
+	'ee_deprecated_finalize_transaction',
219
+	10,
220
+	2
221 221
 );
222 222
 /**
223 223
  * ee_deprecated_finalize_registration
@@ -226,35 +226,35 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function ee_deprecated_finalize_registration(EE_Registration $registration)
228 228
 {
229
-    $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg')
230
-        ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : null;
231
-    if ($action_ref) {
232
-        EE_Error::doing_it_wrong(
233
-            $action_ref,
234
-            sprintf(
235
-                esc_html__(
236
-                    'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"',
237
-                    'event_espresso'
238
-                ),
239
-                '<br />',
240
-                '/core/business/EE_Registration_Processor.class.php',
241
-                'AHEE__EE_Registration_Processor__trigger_registration_update_notifications'
242
-            ),
243
-            '4.6.0'
244
-        );
245
-        do_action(
246
-            'AHEE__EE_Registration__finalize__update_and_new_reg',
247
-            $registration,
248
-            (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))
249
-        );
250
-    }
229
+	$action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg')
230
+		? 'AHEE__EE_Registration__finalize__update_and_new_reg' : null;
231
+	if ($action_ref) {
232
+		EE_Error::doing_it_wrong(
233
+			$action_ref,
234
+			sprintf(
235
+				esc_html__(
236
+					'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"',
237
+					'event_espresso'
238
+				),
239
+				'<br />',
240
+				'/core/business/EE_Registration_Processor.class.php',
241
+				'AHEE__EE_Registration_Processor__trigger_registration_update_notifications'
242
+			),
243
+			'4.6.0'
244
+		);
245
+		do_action(
246
+			'AHEE__EE_Registration__finalize__update_and_new_reg',
247
+			$registration,
248
+			(is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))
249
+		);
250
+	}
251 251
 }
252 252
 
253 253
 add_action(
254
-    'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
255
-    'ee_deprecated_finalize_registration',
256
-    10,
257
-    1
254
+	'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
255
+	'ee_deprecated_finalize_registration',
256
+	10,
257
+	1
258 258
 );
259 259
 
260 260
 
@@ -264,44 +264,44 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function ee_deprecated_hooks()
266 266
 {
267
-    /**
268
-     * @var          $hooks       array where keys are hook names, and their values are array{
269
-     * @type string  $version     when deprecated
270
-     * @type string  $alternative saying what to use instead
271
-     * @type boolean $still_works whether or not the hook still works
272
-     *        }
273
-     */
274
-    $hooks = array(
275
-        'AHEE__EE_System___do_setup_validations' => array(
276
-            'version'     => '4.6.0',
277
-            'alternative' => esc_html__(
278
-                'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)',
279
-                'event_espresso'
280
-            ),
281
-            'still_works' => false,
282
-        ),
283
-    );
284
-    foreach ($hooks as $name => $deprecation_info) {
285
-        if (has_action($name)) {
286
-            EE_Error::doing_it_wrong(
287
-                $name,
288
-                sprintf(
289
-                    esc_html__('This filter is deprecated. %1$s%2$s', 'event_espresso'),
290
-                    $deprecation_info['still_works'] ? esc_html__(
291
-                        'It *may* work as an attempt to build in backwards compatibility.',
292
-                        'event_espresso'
293
-                    ) : esc_html__('It has been completely removed.', 'event_espresso'),
294
-                    isset($deprecation_info['alternative'])
295
-                        ? $deprecation_info['alternative']
296
-                        : esc_html__(
297
-                        'Please read the current EE4 documentation further or contact Support.',
298
-                        'event_espresso'
299
-                    )
300
-                ),
301
-                isset($deprecation_info['version']) ? $deprecation_info['version'] : esc_html__('recently', 'event_espresso')
302
-            );
303
-        }
304
-    }
267
+	/**
268
+	 * @var          $hooks       array where keys are hook names, and their values are array{
269
+	 * @type string  $version     when deprecated
270
+	 * @type string  $alternative saying what to use instead
271
+	 * @type boolean $still_works whether or not the hook still works
272
+	 *        }
273
+	 */
274
+	$hooks = array(
275
+		'AHEE__EE_System___do_setup_validations' => array(
276
+			'version'     => '4.6.0',
277
+			'alternative' => esc_html__(
278
+				'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)',
279
+				'event_espresso'
280
+			),
281
+			'still_works' => false,
282
+		),
283
+	);
284
+	foreach ($hooks as $name => $deprecation_info) {
285
+		if (has_action($name)) {
286
+			EE_Error::doing_it_wrong(
287
+				$name,
288
+				sprintf(
289
+					esc_html__('This filter is deprecated. %1$s%2$s', 'event_espresso'),
290
+					$deprecation_info['still_works'] ? esc_html__(
291
+						'It *may* work as an attempt to build in backwards compatibility.',
292
+						'event_espresso'
293
+					) : esc_html__('It has been completely removed.', 'event_espresso'),
294
+					isset($deprecation_info['alternative'])
295
+						? $deprecation_info['alternative']
296
+						: esc_html__(
297
+						'Please read the current EE4 documentation further or contact Support.',
298
+						'event_espresso'
299
+					)
300
+				),
301
+				isset($deprecation_info['version']) ? $deprecation_info['version'] : esc_html__('recently', 'event_espresso')
302
+			);
303
+		}
304
+	}
305 305
 }
306 306
 
307 307
 add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks');
@@ -316,34 +316,34 @@  discard block
 block discarded – undo
316 316
  */
317 317
 function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
318 318
 {
319
-    $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns')
320
-              || has_action(
321
-                  'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'
322
-              );
323
-    if ($in_use) {
324
-        $msg = esc_html__(
325
-            'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.'
326
-            . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,'
327
-            . 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end '
328
-            . 'to add other actions after a form submission has been received.',
329
-            'event_espresso'
330
-        );
331
-        EE_Error::doing_it_wrong(
332
-            __CLASS__ . '::' . __FUNCTION__,
333
-            $msg,
334
-            '4.8.32.rc.000'
335
-        );
336
-        // it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
337
-        if (is_admin() && ! defined('DOING_AJAX')) {
338
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
339
-        }
340
-    }
341
-    return $in_use;
319
+	$in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns')
320
+			  || has_action(
321
+				  'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'
322
+			  );
323
+	if ($in_use) {
324
+		$msg = esc_html__(
325
+			'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.'
326
+			. 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,'
327
+			. 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end '
328
+			. 'to add other actions after a form submission has been received.',
329
+			'event_espresso'
330
+		);
331
+		EE_Error::doing_it_wrong(
332
+			__CLASS__ . '::' . __FUNCTION__,
333
+			$msg,
334
+			'4.8.32.rc.000'
335
+		);
336
+		// it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
337
+		if (is_admin() && ! defined('DOING_AJAX')) {
338
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
339
+		}
340
+	}
341
+	return $in_use;
342 342
 }
343 343
 
344 344
 add_action(
345
-    'AHEE__Registrations_Admin_Page___registration_details_metabox__start',
346
-    'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'
345
+	'AHEE__Registrations_Admin_Page___registration_details_metabox__start',
346
+	'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'
347 347
 );
348 348
 
349 349
 /**
@@ -355,77 +355,77 @@  discard block
 block discarded – undo
355 355
  */
356 356
 function ee_deprecated_update_attendee_registration_form_old($admin_page)
357 357
 {
358
-    // check if the old hooks are in use. If not, do the default
359
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
360
-        || ! $admin_page instanceof EE_Admin_Page) {
361
-        return;
362
-    }
363
-    $req_data = $admin_page->get_request_data();
364
-    $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false;
365
-    $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false;
366
-    $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
367
-    if (! $REG_ID || ! $qstns) {
368
-        EE_Error::add_error(
369
-            esc_html__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'),
370
-            __FILE__,
371
-            __FUNCTION__,
372
-            __LINE__
373
-        );
374
-    }
375
-    $success = true;
376
-
377
-    // allow others to get in on this awesome fun   :D
378
-    do_action(
379
-        'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save',
380
-        $REG_ID,
381
-        $qstns
382
-    );
383
-    // loop thru questions... FINALLY!!!
384
-
385
-    foreach ($qstns as $QST_ID => $qstn) {
386
-        // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
387
-        if (! is_array($qstn)) {
388
-            $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
389
-            continue;
390
-        }
391
-
392
-
393
-        foreach ($qstn as $ANS_ID => $ANS_value) {
394
-            // get answer
395
-            $query_params = array(
396
-                0 => array(
397
-                    'ANS_ID' => $ANS_ID,
398
-                    'REG_ID' => $REG_ID,
399
-                    'QST_ID' => $QST_ID,
400
-                ),
401
-            );
402
-            $answer = EEM_Answer::instance()->get_one($query_params);
403
-            // this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
404
-            if (! $answer instanceof EE_Answer) {
405
-                $set_values = array(
406
-                    'QST_ID'    => $QST_ID,
407
-                    'REG_ID'    => $REG_ID,
408
-                    'ANS_value' => $qstn,
409
-                );
410
-                $success = EEM_Answer::instance()->insert($set_values);
411
-                continue 2;
412
-            }
413
-
414
-            $answer->set('ANS_value', $ANS_value);
415
-            $success = $answer->save();
416
-        }
417
-    }
418
-    $what = esc_html__('Registration Form', 'event_espresso');
419
-    $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
420
-    $admin_page->redirect_after_action($success, $what, esc_html__('updated', 'event_espresso'), $route);
421
-    exit;
358
+	// check if the old hooks are in use. If not, do the default
359
+	if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
360
+		|| ! $admin_page instanceof EE_Admin_Page) {
361
+		return;
362
+	}
363
+	$req_data = $admin_page->get_request_data();
364
+	$qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false;
365
+	$REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false;
366
+	$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
367
+	if (! $REG_ID || ! $qstns) {
368
+		EE_Error::add_error(
369
+			esc_html__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'),
370
+			__FILE__,
371
+			__FUNCTION__,
372
+			__LINE__
373
+		);
374
+	}
375
+	$success = true;
376
+
377
+	// allow others to get in on this awesome fun   :D
378
+	do_action(
379
+		'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save',
380
+		$REG_ID,
381
+		$qstns
382
+	);
383
+	// loop thru questions... FINALLY!!!
384
+
385
+	foreach ($qstns as $QST_ID => $qstn) {
386
+		// if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
387
+		if (! is_array($qstn)) {
388
+			$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
389
+			continue;
390
+		}
391
+
392
+
393
+		foreach ($qstn as $ANS_ID => $ANS_value) {
394
+			// get answer
395
+			$query_params = array(
396
+				0 => array(
397
+					'ANS_ID' => $ANS_ID,
398
+					'REG_ID' => $REG_ID,
399
+					'QST_ID' => $QST_ID,
400
+				),
401
+			);
402
+			$answer = EEM_Answer::instance()->get_one($query_params);
403
+			// this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
404
+			if (! $answer instanceof EE_Answer) {
405
+				$set_values = array(
406
+					'QST_ID'    => $QST_ID,
407
+					'REG_ID'    => $REG_ID,
408
+					'ANS_value' => $qstn,
409
+				);
410
+				$success = EEM_Answer::instance()->insert($set_values);
411
+				continue 2;
412
+			}
413
+
414
+			$answer->set('ANS_value', $ANS_value);
415
+			$success = $answer->save();
416
+		}
417
+	}
418
+	$what = esc_html__('Registration Form', 'event_espresso');
419
+	$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
420
+	$admin_page->redirect_after_action($success, $what, esc_html__('updated', 'event_espresso'), $route);
421
+	exit;
422 422
 }
423 423
 
424 424
 add_action(
425
-    'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start',
426
-    'ee_deprecated_update_attendee_registration_form_old',
427
-    10,
428
-    1
425
+	'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start',
426
+	'ee_deprecated_update_attendee_registration_form_old',
427
+	10,
428
+	1
429 429
 );
430 430
 /**
431 431
  * Render the registration admin page's custom questions area in the old fashion
@@ -441,50 +441,50 @@  discard block
 block discarded – undo
441 441
  */
442 442
 function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration)
443 443
 {
444
-    // check if the old hooks are in use. If not, do the default
445
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
446
-        || ! $admin_page instanceof EE_Admin_Page) {
447
-        return $do_default_action;
448
-    }
449
-    add_filter(
450
-        'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',
451
-        array($admin_page, 'form_before_question_group'),
452
-        10,
453
-        1
454
-    );
455
-    add_filter(
456
-        'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',
457
-        array($admin_page, 'form_after_question_group'),
458
-        10,
459
-        1
460
-    );
461
-    add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1);
462
-    add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1);
463
-
464
-    $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options(
465
-        $registration,
466
-        $registration->get(
467
-            'EVT_ID'
468
-        )
469
-    );
470
-
471
-    EE_Registry::instance()->load_helper('Form_Fields');
472
-    $template_args = array(
473
-        'att_questions'             => EEH_Form_Fields::generate_question_groups_html($question_groups),
474
-        'reg_questions_form_action' => 'edit_registration',
475
-        'REG_ID'                    => $registration->ID(),
476
-    );
477
-    $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
478
-    echo EEH_Template::display_template($template_path, $template_args, true);
479
-    // indicate that we should not do the default admin page code
480
-    return false;
444
+	// check if the old hooks are in use. If not, do the default
445
+	if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
446
+		|| ! $admin_page instanceof EE_Admin_Page) {
447
+		return $do_default_action;
448
+	}
449
+	add_filter(
450
+		'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',
451
+		array($admin_page, 'form_before_question_group'),
452
+		10,
453
+		1
454
+	);
455
+	add_filter(
456
+		'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',
457
+		array($admin_page, 'form_after_question_group'),
458
+		10,
459
+		1
460
+	);
461
+	add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1);
462
+	add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1);
463
+
464
+	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options(
465
+		$registration,
466
+		$registration->get(
467
+			'EVT_ID'
468
+		)
469
+	);
470
+
471
+	EE_Registry::instance()->load_helper('Form_Fields');
472
+	$template_args = array(
473
+		'att_questions'             => EEH_Form_Fields::generate_question_groups_html($question_groups),
474
+		'reg_questions_form_action' => 'edit_registration',
475
+		'REG_ID'                    => $registration->ID(),
476
+	);
477
+	$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
478
+	echo EEH_Template::display_template($template_path, $template_args, true);
479
+	// indicate that we should not do the default admin page code
480
+	return false;
481 481
 }
482 482
 
483 483
 add_action(
484
-    'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default',
485
-    'ee_deprecated_reg_questions_meta_box_old',
486
-    10,
487
-    3
484
+	'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default',
485
+	'ee_deprecated_reg_questions_meta_box_old',
486
+	10,
487
+	3
488 488
 );
489 489
 
490 490
 
@@ -501,42 +501,42 @@  discard block
 block discarded – undo
501 501
 class EE_Message_Template_Defaults extends EE_Base
502 502
 {
503 503
 
504
-    /**
505
-     * EE_Message_Template_Defaults constructor.
506
-     *
507
-     * @param EE_messages $messages
508
-     * @param             $messenger_name
509
-     * @param             $message_type_name
510
-     * @param int         $GRP_ID
511
-     * @return EE_Messages_Template_Defaults
512
-     */
513
-    public function __construct(
514
-        EE_messages $messages,
515
-        $messenger_name,
516
-        $message_type_name,
517
-        $GRP_ID = 0
518
-    ) {
519
-        EE_Error::doing_it_wrong(
520
-            __FUNCTION__,
521
-            esc_html__(
522
-                'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.',
523
-                'event_espresso'
524
-            ),
525
-            '4.9.0'
526
-        );
527
-        /** @var EE_Message_Resource_Manager $message_resource_manager */
528
-        $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
529
-        $messenger = $message_resource_manager->get_messenger($messenger_name);
530
-        $message_type = $message_resource_manager->get_message_type($message_type_name);
531
-        return EE_Registry::instance()->load_lib(
532
-            'Messages_Template_Defaults',
533
-            array(
534
-                $GRP_ID,
535
-                $messenger,
536
-                $message_type,
537
-            )
538
-        );
539
-    }
504
+	/**
505
+	 * EE_Message_Template_Defaults constructor.
506
+	 *
507
+	 * @param EE_messages $messages
508
+	 * @param             $messenger_name
509
+	 * @param             $message_type_name
510
+	 * @param int         $GRP_ID
511
+	 * @return EE_Messages_Template_Defaults
512
+	 */
513
+	public function __construct(
514
+		EE_messages $messages,
515
+		$messenger_name,
516
+		$message_type_name,
517
+		$GRP_ID = 0
518
+	) {
519
+		EE_Error::doing_it_wrong(
520
+			__FUNCTION__,
521
+			esc_html__(
522
+				'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.',
523
+				'event_espresso'
524
+			),
525
+			'4.9.0'
526
+		);
527
+		/** @var EE_Message_Resource_Manager $message_resource_manager */
528
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
529
+		$messenger = $message_resource_manager->get_messenger($messenger_name);
530
+		$message_type = $message_resource_manager->get_message_type($message_type_name);
531
+		return EE_Registry::instance()->load_lib(
532
+			'Messages_Template_Defaults',
533
+			array(
534
+				$GRP_ID,
535
+				$messenger,
536
+				$message_type,
537
+			)
538
+		);
539
+	}
540 540
 }
541 541
 
542 542
 
@@ -554,525 +554,525 @@  discard block
 block discarded – undo
554 554
 class EE_messages
555 555
 {
556 556
 
557
-    /** @type EE_messenger[] */
558
-    protected $_active_messengers = array();
559
-
560
-    /** @type array */
561
-    protected $_active_message_types = array();
562
-
563
-    /** @type EE_message_type[] */
564
-    protected $_installed_message_types = array();
565
-
566
-    /** @type EE_messenger */
567
-    protected $_messenger;
568
-
569
-    /** @type EE_message_type */
570
-    protected $_message_type;
571
-
572
-    /** @type array */
573
-    protected $_contexts = array();
574
-
575
-    /** @type EE_Message_Resource_Manager $_message_resource_manager */
576
-    protected $_message_resource_manager;
577
-
578
-
579
-    /**
580
-     * EE_messages constructor.
581
-     *
582
-     * @deprecated 4.9.0
583
-     */
584
-    public function __construct()
585
-    {
586
-    }
587
-
588
-
589
-    /**
590
-     * @param string $method
591
-     */
592
-    public function _class_is_deprecated($method)
593
-    {
594
-        EE_Error::doing_it_wrong(
595
-            'EE_messages::' . $method,
596
-            esc_html__('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
597
-            '4.9.0',
598
-            '4.10.0.p'
599
-        );
600
-        // Please use EE_Message_Resource_Manager instead
601
-        $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
602
-    }
603
-
604
-
605
-    /**
606
-     * @deprecated 4.9.0
607
-     * @param string $messenger_name
608
-     * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
609
-     */
610
-    public function ensure_messenger_is_active($messenger_name)
611
-    {
612
-        // EE_messages has been deprecated
613
-        $this->_class_is_deprecated(__FUNCTION__);
614
-        return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name);
615
-    }
616
-
617
-
618
-    /**
619
-     * @deprecated 4.9.0
620
-     * @param string $message_type message type name
621
-     * @param        $messenger
622
-     * @return bool true if it got activated (or was active) and false if not.
623
-     * @throws \EE_Error
624
-     */
625
-    public function ensure_message_type_is_active($message_type, $messenger)
626
-    {
627
-        // EE_messages has been deprecated
628
-        $this->_class_is_deprecated(__FUNCTION__);
629
-        return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger);
630
-    }
631
-
632
-
633
-    /**
634
-     * @deprecated 4.9.0
635
-     * @param string $messenger_name
636
-     * @param array  $mts_to_activate             (optional) An array of message types to activate with this messenger.
637
-     *                                             If included we do NOT setup the default message types (assuming they
638
-     *                                             are already setup.)
639
-     * @return boolean an array of generated templates or false if nothing generated/activated.
640
-     */
641
-    public function activate_messenger($messenger_name, $mts_to_activate = array())
642
-    {
643
-        // EE_messages has been deprecated
644
-        $this->_class_is_deprecated(__FUNCTION__);
645
-        return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate);
646
-    }
647
-
648
-
649
-    /**
650
-     * @deprecated 4.9.0
651
-     * @param EE_messenger    $messenger    messenger used in trigger
652
-     * @param EE_message_type $message_type message type used in trigger
653
-     *
654
-     * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
655
-     */
656
-    public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type)
657
-    {
658
-        // EE_messages has been deprecated
659
-        $this->_class_is_deprecated(__FUNCTION__);
660
-        return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type);
661
-    }
662
-
663
-
664
-    /**
665
-     * @deprecated 4.9.0
666
-     * @param string $messenger
667
-     * @return EE_messenger | null
668
-     */
669
-    public function get_messenger_if_active($messenger)
670
-    {
671
-        // EE_messages has been deprecated
672
-        $this->_class_is_deprecated(__FUNCTION__);
673
-        return $this->_message_resource_manager->get_active_messenger($messenger);
674
-    }
675
-
676
-
677
-    /**
678
-     * @deprecated 4.9.0
679
-     * @param EE_Message $message
680
-     * @return array  An array with 'messenger' and 'message_type' as the index and the corresponding valid object if
681
-     *                  available.
682
-     *                  Eg. Valid Messenger and Message Type:
683
-     *                  array(
684
-     *                  'messenger' => new EE_Email_messenger(),
685
-     *                  'message_type' => new EE_Registration_Approved_message_type()
686
-     *                  )
687
-     *                  Valid Messenger and Invalid Message Type:
688
-     *                  array(
689
-     *                  'messenger' => new EE_Email_messenger(),
690
-     *                  'message_type' => null
691
-     *                  )
692
-     */
693
-    public function validate_for_use(EE_Message $message)
694
-    {
695
-        // EE_messages has been deprecated
696
-        $this->_class_is_deprecated(__FUNCTION__);
697
-        return array(
698
-            'messenger'    => $message->messenger_object(),
699
-            'message_type' => $message->message_type_object(),
700
-        );
701
-    }
702
-
703
-
704
-    /**
705
-     * @deprecated 4.9.0
706
-     * @param  string $type                 What type of message are we sending (corresponds to message types)
707
-     * @param  mixed  $vars                 Data being sent for parsing in the message
708
-     * @param  string $sending_messenger    if included then we ONLY use the specified messenger for delivery.
709
-     *                                      Otherwise we cycle through all active messengers.
710
-     * @param string  $generating_messenger if included then this messenger is used for generating the message
711
-     *                                      templates (but not for sending).
712
-     * @param string  $context              If included then only a message type for a specific context will be
713
-     *                                      generated.
714
-     * @param bool    $send                 Default TRUE.  If false, then this will just return the generated
715
-     *                                      EE_messages objects which might be used by the trigger to setup a batch
716
-     *                                      message (typically html messenger uses it).
717
-     * @return bool
718
-     */
719
-    public function send_message(
720
-        $type,
721
-        $vars,
722
-        $sending_messenger = '',
723
-        $generating_messenger = '',
724
-        $context = '',
725
-        $send = true
726
-    ) {
727
-        // EE_messages has been deprecated
728
-        $this->_class_is_deprecated(__FUNCTION__);
729
-        /** @type EE_Messages_Processor $processor */
730
-        $processor = EE_Registry::instance()->load_lib('Messages_Processor');
731
-        $error = false;
732
-        // try to intelligently determine what method we'll call based on the incoming data.
733
-        // if generating and sending are different then generate and send immediately.
734
-        if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
735
-            // in the legacy system, when generating and sending were different, that means all the
736
-            // vars are already in the request object.  So let's just use that.
737
-            try {
738
-                /** @type EE_Message_To_Generate_From_Request $mtg */
739
-                $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
740
-                $processor->generate_and_send_now($mtg);
741
-            } catch (EE_Error $e) {
742
-                $error_msg = esc_html__(
743
-                    'Please note that a system message failed to send due to a technical issue.',
744
-                    'event_espresso'
745
-                );
746
-                // add specific message for developers if WP_DEBUG in on
747
-                $error_msg .= '||' . $e->getMessage();
748
-                EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
749
-                $error = true;
750
-            }
751
-        } else {
752
-            $processor->generate_for_all_active_messengers($type, $vars, $send);
753
-            // let's find out if there were any errors and how many successfully were queued.
754
-            $count_errors = $processor->get_queue()->count_STS_in_queue(
755
-                array(EEM_Message::status_failed, EEM_Message::status_debug_only)
756
-            );
757
-            $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
758
-            $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry);
759
-            $count_errors = $count_errors + $count_retry;
760
-            if ($count_errors > 0) {
761
-                $error = true;
762
-                if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) {
763
-                    $message = sprintf(
764
-                        esc_html__(
765
-                            'There were %d errors and %d messages successfully queued for generation and sending',
766
-                            'event_espresso'
767
-                        ),
768
-                        $count_errors,
769
-                        $count_queued
770
-                    );
771
-                } elseif ($count_errors > 1 && $count_queued === 1) {
772
-                    $message = sprintf(
773
-                        esc_html__(
774
-                            'There were %d errors and %d message successfully queued for generation.',
775
-                            'event_espresso'
776
-                        ),
777
-                        $count_errors,
778
-                        $count_queued
779
-                    );
780
-                } elseif ($count_errors === 1 && $count_queued > 1) {
781
-                    $message = sprintf(
782
-                        esc_html__(
783
-                            'There was %d error and %d messages successfully queued for generation.',
784
-                            'event_espresso'
785
-                        ),
786
-                        $count_errors,
787
-                        $count_queued
788
-                    );
789
-                } else {
790
-                    $message = sprintf(
791
-                        esc_html__(
792
-                            'There was %d message that failed to be queued for generation.',
793
-                            'event_espresso'
794
-                        ),
795
-                        $count_errors
796
-                    );
797
-                }
798
-                EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__);
799
-            } else {
800
-                if ($count_queued === 1) {
801
-                    $message = sprintf(
802
-                        esc_html__(
803
-                            '%d message successfully queued for generation.',
804
-                            'event_espresso'
805
-                        ),
806
-                        $count_queued
807
-                    );
808
-                } else {
809
-                    $message = sprintf(
810
-                        esc_html__(
811
-                            '%d messages were successfully queued for generation.',
812
-                            'event_espresso'
813
-                        ),
814
-                        $count_queued
815
-                    );
816
-                }
817
-                EE_Error::add_success($message);
818
-            }
819
-        }
820
-        // if no error then return the generated message(s).
821
-        if (! $error && ! $send) {
822
-            $generated_queue = $processor->generate_queue(false);
823
-            // get message and return.
824
-            $generated_queue->get_message_repository()->rewind();
825
-            $messages = array();
826
-            while ($generated_queue->get_message_repository()->valid()) {
827
-                $message = $generated_queue->get_message_repository()->current();
828
-                if ($message instanceof EE_Message) {
829
-                    // set properties that might be expected by add-ons (backward compat)
830
-                    $message->content = $message->content();
831
-                    $message->template_pack = $message->get_template_pack();
832
-                    $message->template_variation = $message->get_template_pack_variation();
833
-                    $messages[] = $message;
834
-                }
835
-                $generated_queue->get_message_repository()->next();
836
-            }
837
-            return $messages;
838
-        }
839
-        return $error ? false
840
-            : true; // yeah backwards eh?  Really what we're returning is if there is a total success for all the messages or not.  We'll modify this once we get message recording in place.
841
-    }
842
-
843
-
844
-    /**
845
-     * @deprecated 4.9.0
846
-     * @param  string $type      This should correspond with a valid message type
847
-     * @param  string $context   This should correspond with a valid context for the message type
848
-     * @param  string $messenger This should correspond with a valid messenger.
849
-     * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular
850
-     *                           preview
851
-     * @return string          The body of the message.
852
-     */
853
-    public function preview_message($type, $context, $messenger, $send = false)
854
-    {
855
-        // EE_messages has been deprecated
856
-        $this->_class_is_deprecated(__FUNCTION__);
857
-        return EED_Messages::preview_message($type, $context, $messenger, $send);
858
-    }
859
-
860
-
861
-    /**
862
-     * @since      4.5.0
863
-     * @deprecated 4.9.0   Moved to EED_Messages Module
864
-     * @param string   $messenger    a string matching a valid active messenger in the system
865
-     * @param string   $message_type Although it seems contrary to the name of the method, a message type name is still
866
-     *                               required to send along the message type to the messenger because this is used for
867
-     *                               determining what specific variations might be loaded for the generated message.
868
-     * @param stdClass $message      a stdClass object in the format expected by the messenger.
869
-     *
870
-     * @return bool          success or fail.
871
-     */
872
-    public function send_message_with_messenger_only($messenger, $message_type, $message)
873
-    {
874
-        // EE_messages has been deprecated
875
-        $this->_class_is_deprecated(__FUNCTION__);
876
-        // setup for sending to new method.
877
-        /** @type EE_Messages_Queue $queue */
878
-        $queue = EE_Registry::instance()->load_lib('Messages_Queue');
879
-        // make sure we have a proper message object
880
-        if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
881
-            $msg = EE_Message_Factory::create(
882
-                array(
883
-                    'MSG_messenger'    => $messenger,
884
-                    'MSG_message_type' => $message_type,
885
-                    'MSG_content'      => $message->content,
886
-                    'MSG_subject'      => $message->subject,
887
-                )
888
-            );
889
-        } else {
890
-            $msg = $message;
891
-        }
892
-        if (! $msg instanceof EE_Message) {
893
-            return false;
894
-        }
895
-        // make sure any content in a content property (if not empty) is set on the MSG_content.
896
-        if (! empty($msg->content)) {
897
-            $msg->set('MSG_content', $msg->content);
898
-        }
899
-        $queue->add($msg);
900
-        return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue);
901
-    }
902
-
903
-
904
-    /**
905
-     * @deprecated 4.9.0
906
-     * @param         $messenger
907
-     * @param  string $message_type message type that the templates are being created for
908
-     * @param int     $GRP_ID
909
-     * @param bool    $is_global
910
-     * @return array|object if creation is successful then we return an array of info, otherwise an error_object is
911
-     *                      returned.
912
-     * @throws \EE_Error
913
-     */
914
-    public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false)
915
-    {
916
-        // EE_messages has been deprecated
917
-        $this->_class_is_deprecated(__FUNCTION__);
918
-        EE_Registry::instance()->load_helper('MSG_Template');
919
-        return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global);
920
-    }
921
-
922
-
923
-    /**
924
-     * @deprecated 4.9.0
925
-     * @param  string $messenger_name    name of EE_messenger
926
-     * @param  string $message_type_name name of EE_message_type
927
-     * @return array
928
-     */
929
-    public function get_fields($messenger_name, $message_type_name)
930
-    {
931
-        // EE_messages has been deprecated
932
-        $this->_class_is_deprecated(__FUNCTION__);
933
-        EE_Registry::instance()->load_helper('MSG_Template');
934
-        return EEH_MSG_Template::get_fields($messenger_name, $message_type_name);
935
-    }
936
-
937
-
938
-    /**
939
-     * @deprecated 4.9.0
940
-     * @access     public
941
-     * @param string $type                we can indicate just returning installed message types
942
-     *                                    or messengers (or both) via this parameter.
943
-     * @param bool   $skip_cache          if true then we skip the cache and retrieve via files.
944
-     * @return array                    multidimensional array of messenger and message_type objects
945
-     *                                    (messengers index, and message_type index);
946
-     */
947
-    public function get_installed($type = 'all', $skip_cache = false)
948
-    {
949
-        // EE_messages has been deprecated
950
-        $this->_class_is_deprecated(__FUNCTION__);
951
-        if ($skip_cache) {
952
-            $this->_message_resource_manager->reset_active_messengers_and_message_types();
953
-        }
954
-        switch ($type) {
955
-            case 'messengers' :
956
-                return array(
957
-                    'messenger' => $this->_message_resource_manager->installed_messengers(),
958
-                );
959
-                break;
960
-            case 'message_types' :
961
-                return array(
962
-                    'message_type' => $this->_message_resource_manager->installed_message_types(),
963
-                );
964
-                break;
965
-            case 'all' :
966
-            default :
967
-                return array(
968
-                    'messenger'    => $this->_message_resource_manager->installed_messengers(),
969
-                    'message_type' => $this->_message_resource_manager->installed_message_types(),
970
-                );
971
-                break;
972
-        }
973
-    }
974
-
975
-
976
-    /**
977
-     * @deprecated 4.9.0
978
-     * @return \EE_messenger[]
979
-     */
980
-    public function get_active_messengers()
981
-    {
982
-        // EE_messages has been deprecated
983
-        $this->_class_is_deprecated(__FUNCTION__);
984
-        return $this->_message_resource_manager->active_messengers();
985
-    }
986
-
987
-
988
-    /**
989
-     * @deprecated 4.9.0
990
-     * @return array array of message_type references (string)
991
-     */
992
-    public function get_active_message_types()
993
-    {
994
-        // EE_messages has been deprecated
995
-        $this->_class_is_deprecated(__FUNCTION__);
996
-        return $this->_message_resource_manager->list_of_active_message_types();
997
-    }
998
-
999
-
1000
-    /**
1001
-     * @deprecated 4.9.0
1002
-     * @return EE_message_type[]
1003
-     */
1004
-    public function get_active_message_type_objects()
1005
-    {
1006
-        // EE_messages has been deprecated
1007
-        $this->_class_is_deprecated(__FUNCTION__);
1008
-        return $this->_message_resource_manager->get_active_message_type_objects();
1009
-    }
1010
-
1011
-
1012
-    /**
1013
-     * @deprecated 4.9.0
1014
-     * @since      4.5.0
1015
-     * @param string $messenger The messenger being checked
1016
-     * @return EE_message_type[]    (or empty array if none present)
1017
-     */
1018
-    public function get_active_message_types_per_messenger($messenger)
1019
-    {
1020
-        // EE_messages has been deprecated
1021
-        $this->_class_is_deprecated(__FUNCTION__);
1022
-        return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger);
1023
-    }
1024
-
1025
-
1026
-    /**
1027
-     * @deprecated 4.9.0
1028
-     * @param string $messenger    The string should correspond to the messenger (message types are
1029
-     * @param string $message_type The string should correspond to a message type.
1030
-     * @return EE_message_type|null
1031
-     */
1032
-    public function get_active_message_type($messenger, $message_type)
1033
-    {
1034
-        // EE_messages has been deprecated
1035
-        $this->_class_is_deprecated(__FUNCTION__);
1036
-        return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type);
1037
-    }
1038
-
1039
-
1040
-    /**
1041
-     * @deprecated 4.9.0
1042
-     * @return array|\EE_message_type[]
1043
-     */
1044
-    public function get_installed_message_types()
1045
-    {
1046
-        // EE_messages has been deprecated
1047
-        $this->_class_is_deprecated(__FUNCTION__);
1048
-        return $this->_message_resource_manager->installed_message_types();
1049
-    }
1050
-
1051
-
1052
-    /**
1053
-     * @deprecated 4.9.0
1054
-     * @return array
1055
-     */
1056
-    public function get_installed_messengers()
1057
-    {
1058
-        // EE_messages has been deprecated
1059
-        $this->_class_is_deprecated(__FUNCTION__);
1060
-        return $this->_message_resource_manager->installed_messengers();
1061
-    }
1062
-
1063
-
1064
-    /**
1065
-     * @deprecated 4.9.0
1066
-     * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by
1067
-     *                           message type.
1068
-     * @return array
1069
-     */
1070
-    public function get_all_contexts($slugs_only = true)
1071
-    {
1072
-        // EE_messages has been deprecated
1073
-        $this->_class_is_deprecated(__FUNCTION__);
1074
-        return $this->_message_resource_manager->get_all_contexts($slugs_only);
1075
-    }
557
+	/** @type EE_messenger[] */
558
+	protected $_active_messengers = array();
559
+
560
+	/** @type array */
561
+	protected $_active_message_types = array();
562
+
563
+	/** @type EE_message_type[] */
564
+	protected $_installed_message_types = array();
565
+
566
+	/** @type EE_messenger */
567
+	protected $_messenger;
568
+
569
+	/** @type EE_message_type */
570
+	protected $_message_type;
571
+
572
+	/** @type array */
573
+	protected $_contexts = array();
574
+
575
+	/** @type EE_Message_Resource_Manager $_message_resource_manager */
576
+	protected $_message_resource_manager;
577
+
578
+
579
+	/**
580
+	 * EE_messages constructor.
581
+	 *
582
+	 * @deprecated 4.9.0
583
+	 */
584
+	public function __construct()
585
+	{
586
+	}
587
+
588
+
589
+	/**
590
+	 * @param string $method
591
+	 */
592
+	public function _class_is_deprecated($method)
593
+	{
594
+		EE_Error::doing_it_wrong(
595
+			'EE_messages::' . $method,
596
+			esc_html__('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
597
+			'4.9.0',
598
+			'4.10.0.p'
599
+		);
600
+		// Please use EE_Message_Resource_Manager instead
601
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
602
+	}
603
+
604
+
605
+	/**
606
+	 * @deprecated 4.9.0
607
+	 * @param string $messenger_name
608
+	 * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
609
+	 */
610
+	public function ensure_messenger_is_active($messenger_name)
611
+	{
612
+		// EE_messages has been deprecated
613
+		$this->_class_is_deprecated(__FUNCTION__);
614
+		return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name);
615
+	}
616
+
617
+
618
+	/**
619
+	 * @deprecated 4.9.0
620
+	 * @param string $message_type message type name
621
+	 * @param        $messenger
622
+	 * @return bool true if it got activated (or was active) and false if not.
623
+	 * @throws \EE_Error
624
+	 */
625
+	public function ensure_message_type_is_active($message_type, $messenger)
626
+	{
627
+		// EE_messages has been deprecated
628
+		$this->_class_is_deprecated(__FUNCTION__);
629
+		return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger);
630
+	}
631
+
632
+
633
+	/**
634
+	 * @deprecated 4.9.0
635
+	 * @param string $messenger_name
636
+	 * @param array  $mts_to_activate             (optional) An array of message types to activate with this messenger.
637
+	 *                                             If included we do NOT setup the default message types (assuming they
638
+	 *                                             are already setup.)
639
+	 * @return boolean an array of generated templates or false if nothing generated/activated.
640
+	 */
641
+	public function activate_messenger($messenger_name, $mts_to_activate = array())
642
+	{
643
+		// EE_messages has been deprecated
644
+		$this->_class_is_deprecated(__FUNCTION__);
645
+		return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate);
646
+	}
647
+
648
+
649
+	/**
650
+	 * @deprecated 4.9.0
651
+	 * @param EE_messenger    $messenger    messenger used in trigger
652
+	 * @param EE_message_type $message_type message type used in trigger
653
+	 *
654
+	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
655
+	 */
656
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type)
657
+	{
658
+		// EE_messages has been deprecated
659
+		$this->_class_is_deprecated(__FUNCTION__);
660
+		return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type);
661
+	}
662
+
663
+
664
+	/**
665
+	 * @deprecated 4.9.0
666
+	 * @param string $messenger
667
+	 * @return EE_messenger | null
668
+	 */
669
+	public function get_messenger_if_active($messenger)
670
+	{
671
+		// EE_messages has been deprecated
672
+		$this->_class_is_deprecated(__FUNCTION__);
673
+		return $this->_message_resource_manager->get_active_messenger($messenger);
674
+	}
675
+
676
+
677
+	/**
678
+	 * @deprecated 4.9.0
679
+	 * @param EE_Message $message
680
+	 * @return array  An array with 'messenger' and 'message_type' as the index and the corresponding valid object if
681
+	 *                  available.
682
+	 *                  Eg. Valid Messenger and Message Type:
683
+	 *                  array(
684
+	 *                  'messenger' => new EE_Email_messenger(),
685
+	 *                  'message_type' => new EE_Registration_Approved_message_type()
686
+	 *                  )
687
+	 *                  Valid Messenger and Invalid Message Type:
688
+	 *                  array(
689
+	 *                  'messenger' => new EE_Email_messenger(),
690
+	 *                  'message_type' => null
691
+	 *                  )
692
+	 */
693
+	public function validate_for_use(EE_Message $message)
694
+	{
695
+		// EE_messages has been deprecated
696
+		$this->_class_is_deprecated(__FUNCTION__);
697
+		return array(
698
+			'messenger'    => $message->messenger_object(),
699
+			'message_type' => $message->message_type_object(),
700
+		);
701
+	}
702
+
703
+
704
+	/**
705
+	 * @deprecated 4.9.0
706
+	 * @param  string $type                 What type of message are we sending (corresponds to message types)
707
+	 * @param  mixed  $vars                 Data being sent for parsing in the message
708
+	 * @param  string $sending_messenger    if included then we ONLY use the specified messenger for delivery.
709
+	 *                                      Otherwise we cycle through all active messengers.
710
+	 * @param string  $generating_messenger if included then this messenger is used for generating the message
711
+	 *                                      templates (but not for sending).
712
+	 * @param string  $context              If included then only a message type for a specific context will be
713
+	 *                                      generated.
714
+	 * @param bool    $send                 Default TRUE.  If false, then this will just return the generated
715
+	 *                                      EE_messages objects which might be used by the trigger to setup a batch
716
+	 *                                      message (typically html messenger uses it).
717
+	 * @return bool
718
+	 */
719
+	public function send_message(
720
+		$type,
721
+		$vars,
722
+		$sending_messenger = '',
723
+		$generating_messenger = '',
724
+		$context = '',
725
+		$send = true
726
+	) {
727
+		// EE_messages has been deprecated
728
+		$this->_class_is_deprecated(__FUNCTION__);
729
+		/** @type EE_Messages_Processor $processor */
730
+		$processor = EE_Registry::instance()->load_lib('Messages_Processor');
731
+		$error = false;
732
+		// try to intelligently determine what method we'll call based on the incoming data.
733
+		// if generating and sending are different then generate and send immediately.
734
+		if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
735
+			// in the legacy system, when generating and sending were different, that means all the
736
+			// vars are already in the request object.  So let's just use that.
737
+			try {
738
+				/** @type EE_Message_To_Generate_From_Request $mtg */
739
+				$mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
740
+				$processor->generate_and_send_now($mtg);
741
+			} catch (EE_Error $e) {
742
+				$error_msg = esc_html__(
743
+					'Please note that a system message failed to send due to a technical issue.',
744
+					'event_espresso'
745
+				);
746
+				// add specific message for developers if WP_DEBUG in on
747
+				$error_msg .= '||' . $e->getMessage();
748
+				EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
749
+				$error = true;
750
+			}
751
+		} else {
752
+			$processor->generate_for_all_active_messengers($type, $vars, $send);
753
+			// let's find out if there were any errors and how many successfully were queued.
754
+			$count_errors = $processor->get_queue()->count_STS_in_queue(
755
+				array(EEM_Message::status_failed, EEM_Message::status_debug_only)
756
+			);
757
+			$count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
758
+			$count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry);
759
+			$count_errors = $count_errors + $count_retry;
760
+			if ($count_errors > 0) {
761
+				$error = true;
762
+				if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) {
763
+					$message = sprintf(
764
+						esc_html__(
765
+							'There were %d errors and %d messages successfully queued for generation and sending',
766
+							'event_espresso'
767
+						),
768
+						$count_errors,
769
+						$count_queued
770
+					);
771
+				} elseif ($count_errors > 1 && $count_queued === 1) {
772
+					$message = sprintf(
773
+						esc_html__(
774
+							'There were %d errors and %d message successfully queued for generation.',
775
+							'event_espresso'
776
+						),
777
+						$count_errors,
778
+						$count_queued
779
+					);
780
+				} elseif ($count_errors === 1 && $count_queued > 1) {
781
+					$message = sprintf(
782
+						esc_html__(
783
+							'There was %d error and %d messages successfully queued for generation.',
784
+							'event_espresso'
785
+						),
786
+						$count_errors,
787
+						$count_queued
788
+					);
789
+				} else {
790
+					$message = sprintf(
791
+						esc_html__(
792
+							'There was %d message that failed to be queued for generation.',
793
+							'event_espresso'
794
+						),
795
+						$count_errors
796
+					);
797
+				}
798
+				EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__);
799
+			} else {
800
+				if ($count_queued === 1) {
801
+					$message = sprintf(
802
+						esc_html__(
803
+							'%d message successfully queued for generation.',
804
+							'event_espresso'
805
+						),
806
+						$count_queued
807
+					);
808
+				} else {
809
+					$message = sprintf(
810
+						esc_html__(
811
+							'%d messages were successfully queued for generation.',
812
+							'event_espresso'
813
+						),
814
+						$count_queued
815
+					);
816
+				}
817
+				EE_Error::add_success($message);
818
+			}
819
+		}
820
+		// if no error then return the generated message(s).
821
+		if (! $error && ! $send) {
822
+			$generated_queue = $processor->generate_queue(false);
823
+			// get message and return.
824
+			$generated_queue->get_message_repository()->rewind();
825
+			$messages = array();
826
+			while ($generated_queue->get_message_repository()->valid()) {
827
+				$message = $generated_queue->get_message_repository()->current();
828
+				if ($message instanceof EE_Message) {
829
+					// set properties that might be expected by add-ons (backward compat)
830
+					$message->content = $message->content();
831
+					$message->template_pack = $message->get_template_pack();
832
+					$message->template_variation = $message->get_template_pack_variation();
833
+					$messages[] = $message;
834
+				}
835
+				$generated_queue->get_message_repository()->next();
836
+			}
837
+			return $messages;
838
+		}
839
+		return $error ? false
840
+			: true; // yeah backwards eh?  Really what we're returning is if there is a total success for all the messages or not.  We'll modify this once we get message recording in place.
841
+	}
842
+
843
+
844
+	/**
845
+	 * @deprecated 4.9.0
846
+	 * @param  string $type      This should correspond with a valid message type
847
+	 * @param  string $context   This should correspond with a valid context for the message type
848
+	 * @param  string $messenger This should correspond with a valid messenger.
849
+	 * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular
850
+	 *                           preview
851
+	 * @return string          The body of the message.
852
+	 */
853
+	public function preview_message($type, $context, $messenger, $send = false)
854
+	{
855
+		// EE_messages has been deprecated
856
+		$this->_class_is_deprecated(__FUNCTION__);
857
+		return EED_Messages::preview_message($type, $context, $messenger, $send);
858
+	}
859
+
860
+
861
+	/**
862
+	 * @since      4.5.0
863
+	 * @deprecated 4.9.0   Moved to EED_Messages Module
864
+	 * @param string   $messenger    a string matching a valid active messenger in the system
865
+	 * @param string   $message_type Although it seems contrary to the name of the method, a message type name is still
866
+	 *                               required to send along the message type to the messenger because this is used for
867
+	 *                               determining what specific variations might be loaded for the generated message.
868
+	 * @param stdClass $message      a stdClass object in the format expected by the messenger.
869
+	 *
870
+	 * @return bool          success or fail.
871
+	 */
872
+	public function send_message_with_messenger_only($messenger, $message_type, $message)
873
+	{
874
+		// EE_messages has been deprecated
875
+		$this->_class_is_deprecated(__FUNCTION__);
876
+		// setup for sending to new method.
877
+		/** @type EE_Messages_Queue $queue */
878
+		$queue = EE_Registry::instance()->load_lib('Messages_Queue');
879
+		// make sure we have a proper message object
880
+		if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
881
+			$msg = EE_Message_Factory::create(
882
+				array(
883
+					'MSG_messenger'    => $messenger,
884
+					'MSG_message_type' => $message_type,
885
+					'MSG_content'      => $message->content,
886
+					'MSG_subject'      => $message->subject,
887
+				)
888
+			);
889
+		} else {
890
+			$msg = $message;
891
+		}
892
+		if (! $msg instanceof EE_Message) {
893
+			return false;
894
+		}
895
+		// make sure any content in a content property (if not empty) is set on the MSG_content.
896
+		if (! empty($msg->content)) {
897
+			$msg->set('MSG_content', $msg->content);
898
+		}
899
+		$queue->add($msg);
900
+		return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue);
901
+	}
902
+
903
+
904
+	/**
905
+	 * @deprecated 4.9.0
906
+	 * @param         $messenger
907
+	 * @param  string $message_type message type that the templates are being created for
908
+	 * @param int     $GRP_ID
909
+	 * @param bool    $is_global
910
+	 * @return array|object if creation is successful then we return an array of info, otherwise an error_object is
911
+	 *                      returned.
912
+	 * @throws \EE_Error
913
+	 */
914
+	public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false)
915
+	{
916
+		// EE_messages has been deprecated
917
+		$this->_class_is_deprecated(__FUNCTION__);
918
+		EE_Registry::instance()->load_helper('MSG_Template');
919
+		return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global);
920
+	}
921
+
922
+
923
+	/**
924
+	 * @deprecated 4.9.0
925
+	 * @param  string $messenger_name    name of EE_messenger
926
+	 * @param  string $message_type_name name of EE_message_type
927
+	 * @return array
928
+	 */
929
+	public function get_fields($messenger_name, $message_type_name)
930
+	{
931
+		// EE_messages has been deprecated
932
+		$this->_class_is_deprecated(__FUNCTION__);
933
+		EE_Registry::instance()->load_helper('MSG_Template');
934
+		return EEH_MSG_Template::get_fields($messenger_name, $message_type_name);
935
+	}
936
+
937
+
938
+	/**
939
+	 * @deprecated 4.9.0
940
+	 * @access     public
941
+	 * @param string $type                we can indicate just returning installed message types
942
+	 *                                    or messengers (or both) via this parameter.
943
+	 * @param bool   $skip_cache          if true then we skip the cache and retrieve via files.
944
+	 * @return array                    multidimensional array of messenger and message_type objects
945
+	 *                                    (messengers index, and message_type index);
946
+	 */
947
+	public function get_installed($type = 'all', $skip_cache = false)
948
+	{
949
+		// EE_messages has been deprecated
950
+		$this->_class_is_deprecated(__FUNCTION__);
951
+		if ($skip_cache) {
952
+			$this->_message_resource_manager->reset_active_messengers_and_message_types();
953
+		}
954
+		switch ($type) {
955
+			case 'messengers' :
956
+				return array(
957
+					'messenger' => $this->_message_resource_manager->installed_messengers(),
958
+				);
959
+				break;
960
+			case 'message_types' :
961
+				return array(
962
+					'message_type' => $this->_message_resource_manager->installed_message_types(),
963
+				);
964
+				break;
965
+			case 'all' :
966
+			default :
967
+				return array(
968
+					'messenger'    => $this->_message_resource_manager->installed_messengers(),
969
+					'message_type' => $this->_message_resource_manager->installed_message_types(),
970
+				);
971
+				break;
972
+		}
973
+	}
974
+
975
+
976
+	/**
977
+	 * @deprecated 4.9.0
978
+	 * @return \EE_messenger[]
979
+	 */
980
+	public function get_active_messengers()
981
+	{
982
+		// EE_messages has been deprecated
983
+		$this->_class_is_deprecated(__FUNCTION__);
984
+		return $this->_message_resource_manager->active_messengers();
985
+	}
986
+
987
+
988
+	/**
989
+	 * @deprecated 4.9.0
990
+	 * @return array array of message_type references (string)
991
+	 */
992
+	public function get_active_message_types()
993
+	{
994
+		// EE_messages has been deprecated
995
+		$this->_class_is_deprecated(__FUNCTION__);
996
+		return $this->_message_resource_manager->list_of_active_message_types();
997
+	}
998
+
999
+
1000
+	/**
1001
+	 * @deprecated 4.9.0
1002
+	 * @return EE_message_type[]
1003
+	 */
1004
+	public function get_active_message_type_objects()
1005
+	{
1006
+		// EE_messages has been deprecated
1007
+		$this->_class_is_deprecated(__FUNCTION__);
1008
+		return $this->_message_resource_manager->get_active_message_type_objects();
1009
+	}
1010
+
1011
+
1012
+	/**
1013
+	 * @deprecated 4.9.0
1014
+	 * @since      4.5.0
1015
+	 * @param string $messenger The messenger being checked
1016
+	 * @return EE_message_type[]    (or empty array if none present)
1017
+	 */
1018
+	public function get_active_message_types_per_messenger($messenger)
1019
+	{
1020
+		// EE_messages has been deprecated
1021
+		$this->_class_is_deprecated(__FUNCTION__);
1022
+		return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger);
1023
+	}
1024
+
1025
+
1026
+	/**
1027
+	 * @deprecated 4.9.0
1028
+	 * @param string $messenger    The string should correspond to the messenger (message types are
1029
+	 * @param string $message_type The string should correspond to a message type.
1030
+	 * @return EE_message_type|null
1031
+	 */
1032
+	public function get_active_message_type($messenger, $message_type)
1033
+	{
1034
+		// EE_messages has been deprecated
1035
+		$this->_class_is_deprecated(__FUNCTION__);
1036
+		return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type);
1037
+	}
1038
+
1039
+
1040
+	/**
1041
+	 * @deprecated 4.9.0
1042
+	 * @return array|\EE_message_type[]
1043
+	 */
1044
+	public function get_installed_message_types()
1045
+	{
1046
+		// EE_messages has been deprecated
1047
+		$this->_class_is_deprecated(__FUNCTION__);
1048
+		return $this->_message_resource_manager->installed_message_types();
1049
+	}
1050
+
1051
+
1052
+	/**
1053
+	 * @deprecated 4.9.0
1054
+	 * @return array
1055
+	 */
1056
+	public function get_installed_messengers()
1057
+	{
1058
+		// EE_messages has been deprecated
1059
+		$this->_class_is_deprecated(__FUNCTION__);
1060
+		return $this->_message_resource_manager->installed_messengers();
1061
+	}
1062
+
1063
+
1064
+	/**
1065
+	 * @deprecated 4.9.0
1066
+	 * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by
1067
+	 *                           message type.
1068
+	 * @return array
1069
+	 */
1070
+	public function get_all_contexts($slugs_only = true)
1071
+	{
1072
+		// EE_messages has been deprecated
1073
+		$this->_class_is_deprecated(__FUNCTION__);
1074
+		return $this->_message_resource_manager->get_all_contexts($slugs_only);
1075
+	}
1076 1076
 
1077 1077
 
1078 1078
 }
@@ -1131,88 +1131,88 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
 
1133 1133
 add_filter(
1134
-    'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1135
-    function ($event_list_iframe_css) {
1136
-        if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1137
-            return $event_list_iframe_css;
1138
-        }
1139
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1140
-            'FHEE__EventsArchiveIframe__event_list_iframe__css',
1141
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1142
-            '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1143
-            '4.9.14',
1144
-            '5.0.0',
1145
-            'filter'
1146
-        );
1147
-        return apply_filters(
1148
-            'FHEE__EventsArchiveIframe__event_list_iframe__css',
1149
-            $event_list_iframe_css
1150
-        );
1151
-    }
1134
+	'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1135
+	function ($event_list_iframe_css) {
1136
+		if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1137
+			return $event_list_iframe_css;
1138
+		}
1139
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1140
+			'FHEE__EventsArchiveIframe__event_list_iframe__css',
1141
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1142
+			'\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1143
+			'4.9.14',
1144
+			'5.0.0',
1145
+			'filter'
1146
+		);
1147
+		return apply_filters(
1148
+			'FHEE__EventsArchiveIframe__event_list_iframe__css',
1149
+			$event_list_iframe_css
1150
+		);
1151
+	}
1152 1152
 );
1153 1153
 add_filter(
1154
-    'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1155
-    function ($event_list_iframe_js) {
1156
-        if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1157
-            return $event_list_iframe_js;
1158
-        }
1159
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1160
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1161
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1162
-            '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1163
-            '4.9.14',
1164
-            '5.0.0',
1165
-            'filter'
1166
-        );
1167
-        return apply_filters(
1168
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1169
-            $event_list_iframe_js
1170
-        );
1171
-    }
1154
+	'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1155
+	function ($event_list_iframe_js) {
1156
+		if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1157
+			return $event_list_iframe_js;
1158
+		}
1159
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1160
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1161
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1162
+			'\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1163
+			'4.9.14',
1164
+			'5.0.0',
1165
+			'filter'
1166
+		);
1167
+		return apply_filters(
1168
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1169
+			$event_list_iframe_js
1170
+		);
1171
+	}
1172 1172
 );
1173 1173
 add_action(
1174
-    'AHEE__EE_Capabilities__addCaps__complete',
1175
-    function ($capabilities_map) {
1176
-        if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1177
-            return;
1178
-        }
1179
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1180
-            'AHEE__EE_Capabilities__init_role_caps__complete',
1181
-            'AHEE__EE_Capabilities__addCaps__complete',
1182
-            '\EE_Capabilities::addCaps()',
1183
-            '4.9.42',
1184
-            '5.0.0'
1185
-        );
1186
-        do_action(
1187
-            'AHEE__EE_Capabilities__init_role_caps__complete',
1188
-            $capabilities_map
1189
-        );
1190
-    }
1174
+	'AHEE__EE_Capabilities__addCaps__complete',
1175
+	function ($capabilities_map) {
1176
+		if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1177
+			return;
1178
+		}
1179
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1180
+			'AHEE__EE_Capabilities__init_role_caps__complete',
1181
+			'AHEE__EE_Capabilities__addCaps__complete',
1182
+			'\EE_Capabilities::addCaps()',
1183
+			'4.9.42',
1184
+			'5.0.0'
1185
+		);
1186
+		do_action(
1187
+			'AHEE__EE_Capabilities__init_role_caps__complete',
1188
+			$capabilities_map
1189
+		);
1190
+	}
1191 1191
 );
1192 1192
 
1193 1193
 add_filter(
1194
-    'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1195
-    function ($existing_attendee, $registration, $attendee_data) {
1196
-        if (! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1197
-            return $existing_attendee;
1198
-        }
1199
-        deprecated_espresso_action_or_filter_doing_it_wrong(
1200
-            'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1201
-            'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1202
-            '\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()',
1203
-            '4.9.34',
1204
-            '5.0.0',
1205
-            'filter'
1206
-        );
1207
-        return apply_filters(
1208
-            'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1209
-            $existing_attendee,
1210
-            $registration,
1211
-            $attendee_data
1212
-        );
1213
-    },
1214
-    10,
1215
-    3
1194
+	'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1195
+	function ($existing_attendee, $registration, $attendee_data) {
1196
+		if (! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1197
+			return $existing_attendee;
1198
+		}
1199
+		deprecated_espresso_action_or_filter_doing_it_wrong(
1200
+			'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1201
+			'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1202
+			'\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()',
1203
+			'4.9.34',
1204
+			'5.0.0',
1205
+			'filter'
1206
+		);
1207
+		return apply_filters(
1208
+			'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1209
+			$existing_attendee,
1210
+			$registration,
1211
+			$attendee_data
1212
+		);
1213
+	},
1214
+	10,
1215
+	3
1216 1216
 );
1217 1217
 
1218 1218
 /**
@@ -1223,88 +1223,88 @@  discard block
 block discarded – undo
1223 1223
 class EE_Event_List_Query extends WP_Query
1224 1224
 {
1225 1225
 
1226
-    private $title;
1227
-
1228
-    private $css_class;
1229
-
1230
-    private $category_slug;
1231
-
1232
-    /**
1233
-     * EE_Event_List_Query constructor.
1234
-     *
1235
-     * @param array $args
1236
-     */
1237
-    public function __construct($args = array())
1238
-    {
1239
-        \EE_Error::doing_it_wrong(
1240
-            __METHOD__,
1241
-            esc_html__(
1242
-                'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
1243
-                'event_espresso'
1244
-            ),
1245
-            '4.9.27',
1246
-            '5.0.0'
1247
-        );
1248
-        $this->title = isset($args['title']) ? $args['title'] : '';
1249
-        $this->css_class = isset($args['css_class']) ? $args['css_class'] : '';
1250
-        $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : '';
1251
-        $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10;
1252
-        // the current "page" we are viewing
1253
-        $paged = max(1, get_query_var('paged'));
1254
-        // Force these args
1255
-        $args = array_merge(
1256
-            $args,
1257
-            array(
1258
-                'post_type'              => 'espresso_events',
1259
-                'posts_per_page'         => $limit,
1260
-                'update_post_term_cache' => false,
1261
-                'update_post_meta_cache' => false,
1262
-                'paged'                  => $paged,
1263
-                'offset'                 => ($paged - 1) * $limit,
1264
-            )
1265
-        );
1266
-        // run the query
1267
-        parent::__construct($args);
1268
-    }
1269
-
1270
-
1271
-    /**
1272
-     * event_list_title
1273
-     *
1274
-     * @param string $event_list_title
1275
-     * @return string
1276
-     */
1277
-    public function event_list_title($event_list_title = '')
1278
-    {
1279
-        if (! empty($this->title)) {
1280
-            return $this->title;
1281
-        }
1282
-        return $event_list_title;
1283
-    }
1284
-
1285
-
1286
-    /**
1287
-     * event_list_css
1288
-     *
1289
-     * @param string $event_list_css
1290
-     * @return string
1291
-     */
1292
-    public function event_list_css($event_list_css = '')
1293
-    {
1294
-        $event_list_css .= ! empty($event_list_css)
1295
-            ? ' '
1296
-            : '';
1297
-        $event_list_css .= ! empty($this->css_class)
1298
-            ? $this->css_class
1299
-            : '';
1300
-        $event_list_css .= ! empty($event_list_css)
1301
-            ? ' '
1302
-            : '';
1303
-        $event_list_css .= ! empty($this->category_slug)
1304
-            ? $this->category_slug
1305
-            : '';
1306
-        return $event_list_css;
1307
-    }
1226
+	private $title;
1227
+
1228
+	private $css_class;
1229
+
1230
+	private $category_slug;
1231
+
1232
+	/**
1233
+	 * EE_Event_List_Query constructor.
1234
+	 *
1235
+	 * @param array $args
1236
+	 */
1237
+	public function __construct($args = array())
1238
+	{
1239
+		\EE_Error::doing_it_wrong(
1240
+			__METHOD__,
1241
+			esc_html__(
1242
+				'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
1243
+				'event_espresso'
1244
+			),
1245
+			'4.9.27',
1246
+			'5.0.0'
1247
+		);
1248
+		$this->title = isset($args['title']) ? $args['title'] : '';
1249
+		$this->css_class = isset($args['css_class']) ? $args['css_class'] : '';
1250
+		$this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : '';
1251
+		$limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10;
1252
+		// the current "page" we are viewing
1253
+		$paged = max(1, get_query_var('paged'));
1254
+		// Force these args
1255
+		$args = array_merge(
1256
+			$args,
1257
+			array(
1258
+				'post_type'              => 'espresso_events',
1259
+				'posts_per_page'         => $limit,
1260
+				'update_post_term_cache' => false,
1261
+				'update_post_meta_cache' => false,
1262
+				'paged'                  => $paged,
1263
+				'offset'                 => ($paged - 1) * $limit,
1264
+			)
1265
+		);
1266
+		// run the query
1267
+		parent::__construct($args);
1268
+	}
1269
+
1270
+
1271
+	/**
1272
+	 * event_list_title
1273
+	 *
1274
+	 * @param string $event_list_title
1275
+	 * @return string
1276
+	 */
1277
+	public function event_list_title($event_list_title = '')
1278
+	{
1279
+		if (! empty($this->title)) {
1280
+			return $this->title;
1281
+		}
1282
+		return $event_list_title;
1283
+	}
1284
+
1285
+
1286
+	/**
1287
+	 * event_list_css
1288
+	 *
1289
+	 * @param string $event_list_css
1290
+	 * @return string
1291
+	 */
1292
+	public function event_list_css($event_list_css = '')
1293
+	{
1294
+		$event_list_css .= ! empty($event_list_css)
1295
+			? ' '
1296
+			: '';
1297
+		$event_list_css .= ! empty($this->css_class)
1298
+			? $this->css_class
1299
+			: '';
1300
+		$event_list_css .= ! empty($event_list_css)
1301
+			? ' '
1302
+			: '';
1303
+		$event_list_css .= ! empty($this->category_slug)
1304
+			? $this->category_slug
1305
+			: '';
1306
+		return $event_list_css;
1307
+	}
1308 1308
 
1309 1309
 }
1310 1310
 
@@ -1321,75 +1321,75 @@  discard block
 block discarded – undo
1321 1321
 {
1322 1322
 
1323 1323
 
1324
-    /**
1325
-     *    class constructor
1326
-     *
1327
-     * @deprecated 4.9.59.p
1328
-     */
1329
-    public function __construct()
1330
-    {
1331
-        EE_Error::doing_it_wrong(
1332
-            __METHOD__,
1333
-            sprintf(
1334
-                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1335
-                __CLASS__,
1336
-                'EventEspresso\core\services\licensing\LicenseServices'
1337
-            ),
1338
-            '4.9.59.p'
1339
-        );
1340
-    }
1341
-
1342
-
1343
-    /**
1344
-     * The purpose of this function is to display information about Event Espresso data collection
1345
-     * and a optin selection for extra data collecting by users.
1346
-     *
1347
-     * @param bool $extra
1348
-     * @return string html.
1349
-     * @deprecated 4.9.59.p
1350
-     */
1351
-    public static function espresso_data_collection_optin_text($extra = true)
1352
-    {
1353
-        EE_Error::doing_it_wrong(
1354
-            __METHOD__,
1355
-            sprintf(
1356
-                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1357
-                __METHOD__,
1358
-                'EventEspresso\core\domain\services\Stats::optinText'
1359
-            ),
1360
-            '4.9.59.p'
1361
-        );
1362
-        Stats::optinText($extra);
1363
-    }
1364
-
1365
-    /**
1366
-     * This is a handy helper method for retrieving whether there is an update available for the given plugin.
1367
-     *
1368
-     * @param  string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to
1369
-     *                          identify plugins. Defaults to core update
1370
-     * @return boolean           True if update available, false if not.
1371
-     * @deprecated 4.9.59.p
1372
-     */
1373
-    public static function is_update_available($basename = '')
1374
-    {
1375
-        EE_Error::doing_it_wrong(
1376
-            __METHOD__,
1377
-            sprintf(
1378
-                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1379
-                __METHOD__,
1380
-                'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable'
1381
-            ),
1382
-            '4.9.59.p'
1383
-        );
1384
-        return LicenseService::isUpdateAvailable($basename);
1385
-    }
1324
+	/**
1325
+	 *    class constructor
1326
+	 *
1327
+	 * @deprecated 4.9.59.p
1328
+	 */
1329
+	public function __construct()
1330
+	{
1331
+		EE_Error::doing_it_wrong(
1332
+			__METHOD__,
1333
+			sprintf(
1334
+				esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1335
+				__CLASS__,
1336
+				'EventEspresso\core\services\licensing\LicenseServices'
1337
+			),
1338
+			'4.9.59.p'
1339
+		);
1340
+	}
1341
+
1342
+
1343
+	/**
1344
+	 * The purpose of this function is to display information about Event Espresso data collection
1345
+	 * and a optin selection for extra data collecting by users.
1346
+	 *
1347
+	 * @param bool $extra
1348
+	 * @return string html.
1349
+	 * @deprecated 4.9.59.p
1350
+	 */
1351
+	public static function espresso_data_collection_optin_text($extra = true)
1352
+	{
1353
+		EE_Error::doing_it_wrong(
1354
+			__METHOD__,
1355
+			sprintf(
1356
+				esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1357
+				__METHOD__,
1358
+				'EventEspresso\core\domain\services\Stats::optinText'
1359
+			),
1360
+			'4.9.59.p'
1361
+		);
1362
+		Stats::optinText($extra);
1363
+	}
1364
+
1365
+	/**
1366
+	 * This is a handy helper method for retrieving whether there is an update available for the given plugin.
1367
+	 *
1368
+	 * @param  string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to
1369
+	 *                          identify plugins. Defaults to core update
1370
+	 * @return boolean           True if update available, false if not.
1371
+	 * @deprecated 4.9.59.p
1372
+	 */
1373
+	public static function is_update_available($basename = '')
1374
+	{
1375
+		EE_Error::doing_it_wrong(
1376
+			__METHOD__,
1377
+			sprintf(
1378
+				esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1379
+				__METHOD__,
1380
+				'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable'
1381
+			),
1382
+			'4.9.59.p'
1383
+		);
1384
+		return LicenseService::isUpdateAvailable($basename);
1385
+	}
1386 1386
 }
1387 1387
 
1388 1388
 add_filter(
1389
-    'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array',
1390
-    'ee_deprecated_registrations_report_csv_legacy_fields',
1391
-    10,
1392
-    2
1389
+	'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array',
1390
+	'ee_deprecated_registrations_report_csv_legacy_fields',
1391
+	10,
1392
+	2
1393 1393
 );
1394 1394
 /**
1395 1395
  * Filters the CSV row to make it appear like the old labels (which were "$pretty_name[$field_name]").
@@ -1406,96 +1406,96 @@  discard block
 block discarded – undo
1406 1406
  */
1407 1407
 function ee_deprecated_registrations_report_csv_legacy_fields($csv_row_data, $reg_row)
1408 1408
 {
1409
-    // no need for all this if nobody is using the deprecated filter
1410
-    if (has_filter('FHEE__EE_Export__report_registrations__reg_csv_array')) {
1411
-        EE_Error::doing_it_wrong(
1412
-            __FUNCTION__,
1413
-            sprintf(
1414
-                // EE_Error::doing_it_wrong with escape HTML, so don't escape it twice by doing it here too.
1415
-                _x(
1416
-                    'The filter "%1$s" has been deprecated. Please use "%2$s" instead.',
1417
-                    'The filter "FHEE__EE_Export__report_registrations__reg_csv_array" has been deprecated. Please use "FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array" instead.',
1418
-                    'event_espresso'
1419
-                ),
1420
-                'FHEE__EE_Export__report_registrations__reg_csv_array',
1421
-                'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array'
1422
-            ),
1423
-            '4.9.69.p',
1424
-            '4.9.75.p'
1425
-        );
1426
-        // there's code that expected the old csv column headers/labels. Let's oblige. Put it back in the old format!
1427
-        // first: what model fields might be used as column headers? (whose format we need to change)
1428
-        $model_fields = array_merge(
1429
-            EEM_Registration::instance()->field_settings(),
1430
-            EEM_Attendee::instance()->field_settings()
1431
-        );
1432
-        // create an array that uses the legacy column headers/labels.
1433
-        $new_csv_row = array();
1434
-        foreach ($csv_row_data as $label => $value) {
1435
-            $new_label = $label;
1436
-            foreach ($model_fields as $field) {
1437
-                if ($label === EEH_Export::get_column_name_for_field($field)) {
1438
-                    // re-add the old field name
1439
-                    $new_label = $label . '[' . $field->get_name() . ']';
1440
-                    break;
1441
-                }
1442
-            }
1443
-            $new_csv_row[$new_label] = $value;
1444
-        }
1445
-        // before we run it through the deprecated filter, set the method `EEH_Export::get_column_name_for_field()`
1446
-        // to create the old column names, because that's what's in the row temporarily
1447
-        add_filter(
1448
-            'FHEE__EEH_Export__get_column_name_for_field__add_field_name',
1449
-            '__return_true',
1450
-            777
1451
-        );
1452
-        // now, those old filters can be run on this data. Have fun!
1453
-        /**
1454
-         * Deprecated. Use FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array instead.
1455
-         *
1456
-         * Filter to change the contents of each row of the registrations report CSV file.
1457
-         * This can be used to add or remote columns from the CSV file, or change their values.                 *
1458
-         * Note: it has this name because originally that's where this filter resided,
1459
-         * and we've left its name as-is for backward compatibility.
1460
-         * Note when using: all rows in the CSV should have the same columns.
1461
-         *
1462
-         * @param array $reg_csv_array keys are column-header names, and values are that columns' value
1463
-         *                             in this row
1464
-         * @param array $reg_row is the row from the database's wp_esp_registration table
1465
-         */
1466
-        $updated_row = apply_filters(
1467
-            'FHEE__EE_Export__report_registrations__reg_csv_array',
1468
-            $new_csv_row,
1469
-            $reg_row
1470
-        );
1471
-
1472
-        // ok now we can revert to normal for EEH_Export::get_column_name_for_field().
1473
-        remove_filter(
1474
-            'FHEE__EEH_Export__get_column_name_for_field__add_field_name',
1475
-            '__return_true',
1476
-            777
1477
-        );
1478
-
1479
-        // great. Now that the old filters are done, we can remove the ugly square brackets from column headers/labels.
1480
-        $updated_and_restored_row = array();
1481
-        foreach ($updated_row as $label => $value) {
1482
-            $matches = array();
1483
-            if (preg_match(
1484
-                    '~([^\[]*)\[(.*)\]~',
1485
-                    $label,
1486
-                    $matches
1487
-                )
1488
-                && isset(
1489
-                    $matches[0],
1490
-                    $matches[1],
1491
-                    $matches[2]
1492
-                )
1493
-            ) {
1494
-                $label = $matches[1];
1495
-            }
1496
-            $updated_and_restored_row[$label] = $value;
1497
-        }
1498
-        $csv_row_data = $updated_and_restored_row;
1499
-    }
1500
-    return $csv_row_data;
1409
+	// no need for all this if nobody is using the deprecated filter
1410
+	if (has_filter('FHEE__EE_Export__report_registrations__reg_csv_array')) {
1411
+		EE_Error::doing_it_wrong(
1412
+			__FUNCTION__,
1413
+			sprintf(
1414
+				// EE_Error::doing_it_wrong with escape HTML, so don't escape it twice by doing it here too.
1415
+				_x(
1416
+					'The filter "%1$s" has been deprecated. Please use "%2$s" instead.',
1417
+					'The filter "FHEE__EE_Export__report_registrations__reg_csv_array" has been deprecated. Please use "FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array" instead.',
1418
+					'event_espresso'
1419
+				),
1420
+				'FHEE__EE_Export__report_registrations__reg_csv_array',
1421
+				'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array'
1422
+			),
1423
+			'4.9.69.p',
1424
+			'4.9.75.p'
1425
+		);
1426
+		// there's code that expected the old csv column headers/labels. Let's oblige. Put it back in the old format!
1427
+		// first: what model fields might be used as column headers? (whose format we need to change)
1428
+		$model_fields = array_merge(
1429
+			EEM_Registration::instance()->field_settings(),
1430
+			EEM_Attendee::instance()->field_settings()
1431
+		);
1432
+		// create an array that uses the legacy column headers/labels.
1433
+		$new_csv_row = array();
1434
+		foreach ($csv_row_data as $label => $value) {
1435
+			$new_label = $label;
1436
+			foreach ($model_fields as $field) {
1437
+				if ($label === EEH_Export::get_column_name_for_field($field)) {
1438
+					// re-add the old field name
1439
+					$new_label = $label . '[' . $field->get_name() . ']';
1440
+					break;
1441
+				}
1442
+			}
1443
+			$new_csv_row[$new_label] = $value;
1444
+		}
1445
+		// before we run it through the deprecated filter, set the method `EEH_Export::get_column_name_for_field()`
1446
+		// to create the old column names, because that's what's in the row temporarily
1447
+		add_filter(
1448
+			'FHEE__EEH_Export__get_column_name_for_field__add_field_name',
1449
+			'__return_true',
1450
+			777
1451
+		);
1452
+		// now, those old filters can be run on this data. Have fun!
1453
+		/**
1454
+		 * Deprecated. Use FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array instead.
1455
+		 *
1456
+		 * Filter to change the contents of each row of the registrations report CSV file.
1457
+		 * This can be used to add or remote columns from the CSV file, or change their values.                 *
1458
+		 * Note: it has this name because originally that's where this filter resided,
1459
+		 * and we've left its name as-is for backward compatibility.
1460
+		 * Note when using: all rows in the CSV should have the same columns.
1461
+		 *
1462
+		 * @param array $reg_csv_array keys are column-header names, and values are that columns' value
1463
+		 *                             in this row
1464
+		 * @param array $reg_row is the row from the database's wp_esp_registration table
1465
+		 */
1466
+		$updated_row = apply_filters(
1467
+			'FHEE__EE_Export__report_registrations__reg_csv_array',
1468
+			$new_csv_row,
1469
+			$reg_row
1470
+		);
1471
+
1472
+		// ok now we can revert to normal for EEH_Export::get_column_name_for_field().
1473
+		remove_filter(
1474
+			'FHEE__EEH_Export__get_column_name_for_field__add_field_name',
1475
+			'__return_true',
1476
+			777
1477
+		);
1478
+
1479
+		// great. Now that the old filters are done, we can remove the ugly square brackets from column headers/labels.
1480
+		$updated_and_restored_row = array();
1481
+		foreach ($updated_row as $label => $value) {
1482
+			$matches = array();
1483
+			if (preg_match(
1484
+					'~([^\[]*)\[(.*)\]~',
1485
+					$label,
1486
+					$matches
1487
+				)
1488
+				&& isset(
1489
+					$matches[0],
1490
+					$matches[1],
1491
+					$matches[2]
1492
+				)
1493
+			) {
1494
+				$label = $matches[1];
1495
+			}
1496
+			$updated_and_restored_row[$label] = $value;
1497
+		}
1498
+		$csv_row_data = $updated_and_restored_row;
1499
+	}
1500
+	return $csv_row_data;
1501 1501
 }
1502 1502
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
     // loop thru and call doing_it_wrong() or remove any that aren't being used
87 87
     foreach ($deprecated_filters as $deprecated_filter => $on) {
88 88
         // was this filter called ?
89
-        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) {
89
+        if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) {
90 90
             // only display doing_it_wrong() notice to Event Admins during non-AJAX requests
91 91
             if (EE_Registry::instance()->CAP->current_user_can(
92 92
                     'ee_read_ee',
93 93
                     'hide_doing_it_wrong_for_deprecated_SPCO_filter'
94 94
                 ) && ! defined('DOING_AJAX')) {
95 95
                 EE_Error::doing_it_wrong(
96
-                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
96
+                    'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
97 97
                     sprintf(
98 98
                         esc_html__(
99 99
                             'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"',
100 100
                             'event_espresso'
101 101
                         ),
102
-                        'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
102
+                        'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
103 103
                         '<br />',
104 104
                         'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
105 105
                         '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
                 );
109 109
             }
110 110
         } else {
111
-            unset($deprecated_filters[ $deprecated_filter ]);
111
+            unset($deprecated_filters[$deprecated_filter]);
112 112
         }
113 113
     }
114
-    if (! empty($deprecated_filters)) {
114
+    if ( ! empty($deprecated_filters)) {
115 115
 
116 116
         if ($checkout->current_step->slug(
117 117
             ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                 $submit_button_text = apply_filters(
146 146
                                           'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to',
147 147
                                           $submit_button_text
148
-                                      ) . $checkout->next_step->name();
148
+                                      ).$checkout->next_step->name();
149 149
             }
150 150
         }
151 151
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             'event_espresso'
330 330
         );
331 331
         EE_Error::doing_it_wrong(
332
-            __CLASS__ . '::' . __FUNCTION__,
332
+            __CLASS__.'::'.__FUNCTION__,
333 333
             $msg,
334 334
             '4.8.32.rc.000'
335 335
         );
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 function ee_deprecated_update_attendee_registration_form_old($admin_page)
357 357
 {
358 358
     // check if the old hooks are in use. If not, do the default
359
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
359
+    if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
360 360
         || ! $admin_page instanceof EE_Admin_Page) {
361 361
         return;
362 362
     }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false;
365 365
     $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false;
366 366
     $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
367
-    if (! $REG_ID || ! $qstns) {
367
+    if ( ! $REG_ID || ! $qstns) {
368 368
         EE_Error::add_error(
369 369
             esc_html__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'),
370 370
             __FILE__,
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
     foreach ($qstns as $QST_ID => $qstn) {
386 386
         // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
387
-        if (! is_array($qstn)) {
387
+        if ( ! is_array($qstn)) {
388 388
             $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
389 389
             continue;
390 390
         }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             );
402 402
             $answer = EEM_Answer::instance()->get_one($query_params);
403 403
             // this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
404
-            if (! $answer instanceof EE_Answer) {
404
+            if ( ! $answer instanceof EE_Answer) {
405 405
                 $set_values = array(
406 406
                     'QST_ID'    => $QST_ID,
407 407
                     'REG_ID'    => $REG_ID,
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration)
443 443
 {
444 444
     // check if the old hooks are in use. If not, do the default
445
-    if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
445
+    if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
446 446
         || ! $admin_page instanceof EE_Admin_Page) {
447 447
         return $do_default_action;
448 448
     }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         'reg_questions_form_action' => 'edit_registration',
475 475
         'REG_ID'                    => $registration->ID(),
476 476
     );
477
-    $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
477
+    $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
478 478
     echo EEH_Template::display_template($template_path, $template_args, true);
479 479
     // indicate that we should not do the default admin page code
480 480
     return false;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
     public function _class_is_deprecated($method)
593 593
     {
594 594
         EE_Error::doing_it_wrong(
595
-            'EE_messages::' . $method,
595
+            'EE_messages::'.$method,
596 596
             esc_html__('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
597 597
             '4.9.0',
598 598
             '4.10.0.p'
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
         $error = false;
732 732
         // try to intelligently determine what method we'll call based on the incoming data.
733 733
         // if generating and sending are different then generate and send immediately.
734
-        if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
734
+        if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
735 735
             // in the legacy system, when generating and sending were different, that means all the
736 736
             // vars are already in the request object.  So let's just use that.
737 737
             try {
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
                     'event_espresso'
745 745
                 );
746 746
                 // add specific message for developers if WP_DEBUG in on
747
-                $error_msg .= '||' . $e->getMessage();
747
+                $error_msg .= '||'.$e->getMessage();
748 748
                 EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
749 749
                 $error = true;
750 750
             }
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
             }
819 819
         }
820 820
         // if no error then return the generated message(s).
821
-        if (! $error && ! $send) {
821
+        if ( ! $error && ! $send) {
822 822
             $generated_queue = $processor->generate_queue(false);
823 823
             // get message and return.
824 824
             $generated_queue->get_message_repository()->rewind();
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
         /** @type EE_Messages_Queue $queue */
878 878
         $queue = EE_Registry::instance()->load_lib('Messages_Queue');
879 879
         // make sure we have a proper message object
880
-        if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
880
+        if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
881 881
             $msg = EE_Message_Factory::create(
882 882
                 array(
883 883
                     'MSG_messenger'    => $messenger,
@@ -889,11 +889,11 @@  discard block
 block discarded – undo
889 889
         } else {
890 890
             $msg = $message;
891 891
         }
892
-        if (! $msg instanceof EE_Message) {
892
+        if ( ! $msg instanceof EE_Message) {
893 893
             return false;
894 894
         }
895 895
         // make sure any content in a content property (if not empty) is set on the MSG_content.
896
-        if (! empty($msg->content)) {
896
+        if ( ! empty($msg->content)) {
897 897
             $msg->set('MSG_content', $msg->content);
898 898
         }
899 899
         $queue->add($msg);
@@ -1132,8 +1132,8 @@  discard block
 block discarded – undo
1132 1132
 
1133 1133
 add_filter(
1134 1134
     'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1135
-    function ($event_list_iframe_css) {
1136
-        if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1135
+    function($event_list_iframe_css) {
1136
+        if ( ! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) {
1137 1137
             return $event_list_iframe_css;
1138 1138
         }
1139 1139
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1152,8 +1152,8 @@  discard block
 block discarded – undo
1152 1152
 );
1153 1153
 add_filter(
1154 1154
     'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1155
-    function ($event_list_iframe_js) {
1156
-        if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1155
+    function($event_list_iframe_js) {
1156
+        if ( ! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) {
1157 1157
             return $event_list_iframe_js;
1158 1158
         }
1159 1159
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1172,8 +1172,8 @@  discard block
 block discarded – undo
1172 1172
 );
1173 1173
 add_action(
1174 1174
     'AHEE__EE_Capabilities__addCaps__complete',
1175
-    function ($capabilities_map) {
1176
-        if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1175
+    function($capabilities_map) {
1176
+        if ( ! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) {
1177 1177
             return;
1178 1178
         }
1179 1179
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 add_filter(
1194 1194
     'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1195
-    function ($existing_attendee, $registration, $attendee_data) {
1196
-        if (! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1195
+    function($existing_attendee, $registration, $attendee_data) {
1196
+        if ( ! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) {
1197 1197
             return $existing_attendee;
1198 1198
         }
1199 1199
         deprecated_espresso_action_or_filter_doing_it_wrong(
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
      */
1277 1277
     public function event_list_title($event_list_title = '')
1278 1278
     {
1279
-        if (! empty($this->title)) {
1279
+        if ( ! empty($this->title)) {
1280 1280
             return $this->title;
1281 1281
         }
1282 1282
         return $event_list_title;
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
             foreach ($model_fields as $field) {
1437 1437
                 if ($label === EEH_Export::get_column_name_for_field($field)) {
1438 1438
                     // re-add the old field name
1439
-                    $new_label = $label . '[' . $field->get_name() . ']';
1439
+                    $new_label = $label.'['.$field->get_name().']';
1440 1440
                     break;
1441 1441
                 }
1442 1442
             }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Class_Base.core.php 2 patches
Indentation   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -17,408 +17,408 @@
 block discarded – undo
17 17
 abstract class EE_Data_Migration_Class_Base
18 18
 {
19 19
 
20
-    /**
21
-     * @var $records_to_migrate int count of all that have been migrated
22
-     */
23
-    protected $_records_to_migrate = 0;
24
-
25
-    /**
26
-     *
27
-     * @var $records_migrated int
28
-     */
29
-    protected $_records_migrated = 0;
30
-
31
-    /**
32
-     * Whether this migration script is done or not. This COULD be deduced by
33
-     * _records_to_migrate and _records_migrated, but that might nto be accurate
34
-     *
35
-     * @var string one of EE_Data_migration_Manager::status_* constants
36
-     */
37
-    protected $_status = null;
38
-
39
-    /**
40
-     * internationalized name of this class. Convention is to NOT restate that
41
-     * this class if a migration script or a migration script stage
42
-     *
43
-     * @var string (i18ned)
44
-     */
45
-    protected $_pretty_name = null;
46
-
47
-    /**
48
-     * @var array
49
-     */
50
-    protected $_errors = array();
51
-
52
-    /**
53
-     * @var \EventEspresso\core\services\database\TableManager $table_manager
54
-     */
55
-    protected $_table_manager;
56
-
57
-    /**
58
-     * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis
59
-     */
60
-    protected $_table_analysis;
61
-
62
-
63
-    /**
64
-     * Just initializes the status of the migration
65
-     *
66
-     * @param TableManager  $table_manager
67
-     * @param TableAnalysis $table_analysis
68
-     */
69
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
70
-    {
71
-        $this->_table_manager = $table_manager;
72
-        $this->_table_analysis = $table_analysis;
73
-        $this->set_status(EE_Data_Migration_Manager::status_continue);
74
-    }
75
-
76
-
77
-    /**
78
-     * Just gets the pretty name for this migration script or stage
79
-     *
80
-     * @throws EE_Error
81
-     * @return string
82
-     */
83
-    public function pretty_name()
84
-    {
85
-        if ($this->_pretty_name === null) {
86
-            throw new EE_Error(
87
-                sprintf(
88
-                    esc_html__(
89
-                        "Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor",
90
-                        "event_espresso"
91
-                    ),
92
-                    get_class($this)
93
-                )
94
-            );
95
-        }
96
-        return $this->_pretty_name;
97
-    }
98
-
99
-    /**
100
-     *
101
-     * @return int
102
-     */
103
-    public function count_records_to_migrate()
104
-    {
105
-        if ($this->_records_to_migrate == null) {
106
-            $this->_records_to_migrate = $this->_count_records_to_migrate();
107
-        }
108
-        return $this->_records_to_migrate;
109
-    }
110
-
111
-    /**
112
-     * Counts records already migrated. This should only be implemented by EE_Data_Migration_Script_base and
113
-     * EE_Data_migration_Script_Stage
114
-     *
115
-     * @return int
116
-     */
117
-    abstract public function count_records_migrated();
118
-
119
-    /**
120
-     * Counts the records to migrate; the public version may cache it
121
-     *
122
-     * @return int
123
-     */
124
-    abstract protected function _count_records_to_migrate();
125
-
126
-    /**
127
-     * Returns a string indicating the migration script's status.
128
-     *
129
-     * @return string one of EE_Data_Migration_Manager::status_* constants
130
-     * @throws EE_Error
131
-     */
132
-    public function get_status()
133
-    {
134
-        if ($this->_status === null) {
135
-            throw new EE_Error(
136
-                sprintf(
137
-                    esc_html__(
138
-                        "Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.",
139
-                        "event_espresso"
140
-                    ),
141
-                    get_class($this)
142
-                )
143
-            );
144
-        }
145
-        return $this->_status;
146
-    }
147
-
148
-    /**
149
-     *
150
-     * @param string $status
151
-     * @return void
152
-     */
153
-    protected function set_status($status)
154
-    {
155
-        $this->_status = $status;
156
-    }
157
-
158
-    /**
159
-     * @return array of strings
160
-     */
161
-    abstract public function get_errors();
162
-
163
-    /**
164
-     * Returns the last error that occurred. If none occurred, returns null
165
-     *
166
-     * @return string
167
-     */
168
-    public function get_last_error()
169
-    {
170
-        $errors = $this->get_errors();
171
-        if ($errors) {
172
-            return end($errors);
173
-        } else {
174
-            return null;
175
-        }
176
-    }
177
-
178
-    /**
179
-     * Adds an error to the array of errors on this class.
180
-     *
181
-     * @param string  $error a string describing the error that will be useful for debugging. Consider including all
182
-     *                       the data that led to the error, and a stack trace etc.
183
-     * @param boolean $force force the error to be added (because otherwise we have a limit). If forcing and errors are
184
-     *                       already at their limit, we will purposefully forget the first half
185
-     */
186
-    public function add_error($error, $force = false)
187
-    {
188
-        if (! defined('EE_DMS_ERROR_LIMIT')) {
189
-            $limit = 50;
190
-        } else {
191
-            $limit = EE_DMS_ERROR_LIMIT;
192
-        }
193
-        // make sure errors is an array, see ticket #8261
194
-        if (is_string($this->_errors)) {
195
-            $this->_errors = array($this->_errors);
196
-        }
197
-        if (count($this->_errors) >= $limit) {
198
-            if ($force) {
199
-                // get rid of the first half of the errors and any above the limit
200
-                $this->_errors = array_slice($this->_errors, $limit / 2, $limit / 2);
201
-                $this->_errors[] = "Limit reached; removed first half of errors to save space";
202
-                $this->_errors[] = $error;
203
-            } else {
204
-                $this->_errors[ $limit ] = 'More, but limit reached...';
205
-            }
206
-        } else {
207
-            $this->_errors[] = $error;
208
-        }
209
-    }
210
-
211
-    /**
212
-     * Indicates there was a fatal error and the migration cannot possibly continue
213
-     *
214
-     * @return boolean
215
-     */
216
-    public function is_broken()
217
-    {
218
-        return $this->get_status() == EE_Data_Migration_Manager::status_fatal_error;
219
-    }
220
-
221
-    /**
222
-     * @deprecated since 4.6.12
223
-     */
224
-    public function is_borked()
225
-    {
226
-        EE_Error::doing_it_wrong(
227
-            'is_borked',
228
-            esc_html__(
229
-                'The cheeky "is_borked" method had been replaced with the more proper "is_broken"',
230
-                'event_espresso'
231
-            ),
232
-            '4.6.12'
233
-        );
234
-        return $this->is_broken();
235
-    }
236
-
237
-    /**
238
-     * Sets the status to as having a fatal error
239
-     */
240
-    public function set_broken()
241
-    {
242
-        $this->_status = EE_Data_Migration_Manager::status_fatal_error;
243
-    }
244
-
245
-    /**
246
-     *
247
-     * @deprecated since 4.6.12
248
-     */
249
-    public function set_borked()
250
-    {
251
-        EE_Error::doing_it_wrong(
252
-            'is_borked',
253
-            esc_html__(
254
-                'The cheeky "is_borked" method had been replaced with the more proper "is_broken"',
255
-                'event_espresso'
256
-            ),
257
-            '4.6.12'
258
-        );
259
-        return $this->set_broken();
260
-    }
261
-
262
-    /**
263
-     * Checks if this thing believes it is completed
264
-     *
265
-     * @return boolean
266
-     */
267
-    public function is_completed()
268
-    {
269
-        return $this->get_status() == EE_Data_Migration_Manager::status_completed;
270
-    }
271
-
272
-    /**
273
-     * Checks if the current script has more to do or not (ie, if it's status is CONTINUE)
274
-     *
275
-     * @return boolean
276
-     */
277
-    public function has_more_to_do()
278
-    {
279
-        return $this->get_status() == EE_Data_Migration_Manager::status_continue;
280
-    }
281
-
282
-    /**
283
-     * Marks that we believe this migration thing is completed
284
-     */
285
-    public function set_completed()
286
-    {
287
-        $this->_status = EE_Data_Migration_Manager::status_completed;
288
-    }
289
-
290
-    /**
291
-     * Marks that we think this migration class can continue to migrate
292
-     */
293
-    public function reattempt()
294
-    {
295
-        $this->_status = EE_Data_Migration_Manager::status_continue;
296
-        $this->add_error(esc_html__('Reattempt migration', 'event_espresso'), true);
297
-    }
298
-
299
-    /**
300
-     * A lot like "__sleep()" magic method in purpose, this is meant for persisting this class'
301
-     * properties to the DB. However, we don't want to use __sleep() because its quite
302
-     * possible that this class is defined when it goes to sleep, but NOT available when it
303
-     * awakes (eg, this class is part of an addon that is deactivated at some point).
304
-     */
305
-    public function properties_as_array()
306
-    {
307
-        $properties = get_object_vars($this);
308
-        $properties['class'] = get_class($this);
309
-        unset($properties['_migration_script']);
310
-        unset($properties['_table_manager']);
311
-        unset($properties['_table_analysis']);
312
-        return $properties;
313
-    }
314
-
315
-    /**
316
-     * Sets all of the properties of this script stage to match what's in the array, which is assumed
317
-     * to have been made from the properties_as_array() function.
318
-     *
319
-     * @param array $array_of_properties like what's produced from properties_as_array() method
320
-     */
321
-    abstract public function instantiate_from_array_of_properties($array_of_properties);
322
-
323
-    /**
324
-     * Convenience method for showing a database insertion error
325
-     *
326
-     * @param string $old_table
327
-     * @param array  $old_row_as_array
328
-     * @param string $new_table
329
-     * @param array  $new_row_as_array columns=>values like used in wpdb->insert
330
-     * @param array  $data_types       numerically indexed
331
-     * @return string
332
-     */
333
-    protected function _create_error_message_for_db_insertion(
334
-        $old_table,
335
-        $old_row_as_array,
336
-        $new_table,
337
-        $new_row_as_array,
338
-        $data_types
339
-    ) {
340
-        global $wpdb;
341
-        $old_columns_and_values_for_string = array();
342
-        foreach ($old_row_as_array as $column => $value) {
343
-            $old_columns_and_values_for_string[] = "$column => $value";
344
-        }
345
-        $new_columns_and_values_for_string = array();
346
-        $count = 0;
347
-        foreach ($new_row_as_array as $column => $value) {
348
-            $new_columns_and_values_for_string[] = " $column => $value (" . $data_types[ $count++ ] . ")";
349
-        }
350
-        return sprintf(
351
-            esc_html__(
352
-                'Received error "%6$s" inserting row %5$s %1$s %5$s into table %2$s.%5$s Data used was %5$s %3$s %5$s from table %4$s.',
353
-                'event_espresso'
354
-            ),
355
-            implode(", ", $new_columns_and_values_for_string),
356
-            $new_table,
357
-            implode(", ", $old_columns_and_values_for_string),
358
-            $old_table,
359
-            '<br/>',
360
-            $wpdb->last_error
361
-        );
362
-    }
363
-
364
-
365
-    /**
366
-     * Same as json_encode, just avoids putting
367
-     * serialized arrays into the http build query, as that would
368
-     *
369
-     * @param array $array_of_data
370
-     * @return string
371
-     */
372
-    protected function _json_encode($array_of_data)
373
-    {
374
-        // we'd rather NOT serialize the transaction details
375
-        $fields_to_include = array();
376
-        foreach ($array_of_data as $name => $value) {
377
-            $unserialized_data = @unserialize($value);
378
-            if ($unserialized_data === false) {
379
-                $fields_to_include[ $name ] = $value;
380
-            }
381
-        }
382
-        return wp_json_encode($fields_to_include);
383
-    }
384
-
385
-    /**
386
-     * Gets the table manager (or throws an exception if it cannot be retrieved)
387
-     *
388
-     * @return TableManager
389
-     * @throws EE_Error
390
-     */
391
-    protected function _get_table_manager()
392
-    {
393
-        if ($this->_table_manager instanceof TableManager) {
394
-            return $this->_table_manager;
395
-        } else {
396
-            throw new EE_Error(
397
-                sprintf(
398
-                    esc_html__('Table manager on migration class %1$s is not set properly.', 'event_espresso'),
399
-                    get_class($this)
400
-                )
401
-            );
402
-        }
403
-    }
404
-
405
-    /**
406
-     * Gets the injected table analyzer, or throws an exception
407
-     *
408
-     * @return TableAnalysis
409
-     * @throws EE_Error
410
-     */
411
-    protected function _get_table_analysis()
412
-    {
413
-        if ($this->_table_analysis instanceof TableAnalysis) {
414
-            return $this->_table_analysis;
415
-        } else {
416
-            throw new EE_Error(
417
-                sprintf(
418
-                    esc_html__('Table analysis class on migration class %1$s is not set properly.', 'event_espresso'),
419
-                    get_class($this)
420
-                )
421
-            );
422
-        }
423
-    }
20
+	/**
21
+	 * @var $records_to_migrate int count of all that have been migrated
22
+	 */
23
+	protected $_records_to_migrate = 0;
24
+
25
+	/**
26
+	 *
27
+	 * @var $records_migrated int
28
+	 */
29
+	protected $_records_migrated = 0;
30
+
31
+	/**
32
+	 * Whether this migration script is done or not. This COULD be deduced by
33
+	 * _records_to_migrate and _records_migrated, but that might nto be accurate
34
+	 *
35
+	 * @var string one of EE_Data_migration_Manager::status_* constants
36
+	 */
37
+	protected $_status = null;
38
+
39
+	/**
40
+	 * internationalized name of this class. Convention is to NOT restate that
41
+	 * this class if a migration script or a migration script stage
42
+	 *
43
+	 * @var string (i18ned)
44
+	 */
45
+	protected $_pretty_name = null;
46
+
47
+	/**
48
+	 * @var array
49
+	 */
50
+	protected $_errors = array();
51
+
52
+	/**
53
+	 * @var \EventEspresso\core\services\database\TableManager $table_manager
54
+	 */
55
+	protected $_table_manager;
56
+
57
+	/**
58
+	 * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis
59
+	 */
60
+	protected $_table_analysis;
61
+
62
+
63
+	/**
64
+	 * Just initializes the status of the migration
65
+	 *
66
+	 * @param TableManager  $table_manager
67
+	 * @param TableAnalysis $table_analysis
68
+	 */
69
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
70
+	{
71
+		$this->_table_manager = $table_manager;
72
+		$this->_table_analysis = $table_analysis;
73
+		$this->set_status(EE_Data_Migration_Manager::status_continue);
74
+	}
75
+
76
+
77
+	/**
78
+	 * Just gets the pretty name for this migration script or stage
79
+	 *
80
+	 * @throws EE_Error
81
+	 * @return string
82
+	 */
83
+	public function pretty_name()
84
+	{
85
+		if ($this->_pretty_name === null) {
86
+			throw new EE_Error(
87
+				sprintf(
88
+					esc_html__(
89
+						"Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor",
90
+						"event_espresso"
91
+					),
92
+					get_class($this)
93
+				)
94
+			);
95
+		}
96
+		return $this->_pretty_name;
97
+	}
98
+
99
+	/**
100
+	 *
101
+	 * @return int
102
+	 */
103
+	public function count_records_to_migrate()
104
+	{
105
+		if ($this->_records_to_migrate == null) {
106
+			$this->_records_to_migrate = $this->_count_records_to_migrate();
107
+		}
108
+		return $this->_records_to_migrate;
109
+	}
110
+
111
+	/**
112
+	 * Counts records already migrated. This should only be implemented by EE_Data_Migration_Script_base and
113
+	 * EE_Data_migration_Script_Stage
114
+	 *
115
+	 * @return int
116
+	 */
117
+	abstract public function count_records_migrated();
118
+
119
+	/**
120
+	 * Counts the records to migrate; the public version may cache it
121
+	 *
122
+	 * @return int
123
+	 */
124
+	abstract protected function _count_records_to_migrate();
125
+
126
+	/**
127
+	 * Returns a string indicating the migration script's status.
128
+	 *
129
+	 * @return string one of EE_Data_Migration_Manager::status_* constants
130
+	 * @throws EE_Error
131
+	 */
132
+	public function get_status()
133
+	{
134
+		if ($this->_status === null) {
135
+			throw new EE_Error(
136
+				sprintf(
137
+					esc_html__(
138
+						"Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.",
139
+						"event_espresso"
140
+					),
141
+					get_class($this)
142
+				)
143
+			);
144
+		}
145
+		return $this->_status;
146
+	}
147
+
148
+	/**
149
+	 *
150
+	 * @param string $status
151
+	 * @return void
152
+	 */
153
+	protected function set_status($status)
154
+	{
155
+		$this->_status = $status;
156
+	}
157
+
158
+	/**
159
+	 * @return array of strings
160
+	 */
161
+	abstract public function get_errors();
162
+
163
+	/**
164
+	 * Returns the last error that occurred. If none occurred, returns null
165
+	 *
166
+	 * @return string
167
+	 */
168
+	public function get_last_error()
169
+	{
170
+		$errors = $this->get_errors();
171
+		if ($errors) {
172
+			return end($errors);
173
+		} else {
174
+			return null;
175
+		}
176
+	}
177
+
178
+	/**
179
+	 * Adds an error to the array of errors on this class.
180
+	 *
181
+	 * @param string  $error a string describing the error that will be useful for debugging. Consider including all
182
+	 *                       the data that led to the error, and a stack trace etc.
183
+	 * @param boolean $force force the error to be added (because otherwise we have a limit). If forcing and errors are
184
+	 *                       already at their limit, we will purposefully forget the first half
185
+	 */
186
+	public function add_error($error, $force = false)
187
+	{
188
+		if (! defined('EE_DMS_ERROR_LIMIT')) {
189
+			$limit = 50;
190
+		} else {
191
+			$limit = EE_DMS_ERROR_LIMIT;
192
+		}
193
+		// make sure errors is an array, see ticket #8261
194
+		if (is_string($this->_errors)) {
195
+			$this->_errors = array($this->_errors);
196
+		}
197
+		if (count($this->_errors) >= $limit) {
198
+			if ($force) {
199
+				// get rid of the first half of the errors and any above the limit
200
+				$this->_errors = array_slice($this->_errors, $limit / 2, $limit / 2);
201
+				$this->_errors[] = "Limit reached; removed first half of errors to save space";
202
+				$this->_errors[] = $error;
203
+			} else {
204
+				$this->_errors[ $limit ] = 'More, but limit reached...';
205
+			}
206
+		} else {
207
+			$this->_errors[] = $error;
208
+		}
209
+	}
210
+
211
+	/**
212
+	 * Indicates there was a fatal error and the migration cannot possibly continue
213
+	 *
214
+	 * @return boolean
215
+	 */
216
+	public function is_broken()
217
+	{
218
+		return $this->get_status() == EE_Data_Migration_Manager::status_fatal_error;
219
+	}
220
+
221
+	/**
222
+	 * @deprecated since 4.6.12
223
+	 */
224
+	public function is_borked()
225
+	{
226
+		EE_Error::doing_it_wrong(
227
+			'is_borked',
228
+			esc_html__(
229
+				'The cheeky "is_borked" method had been replaced with the more proper "is_broken"',
230
+				'event_espresso'
231
+			),
232
+			'4.6.12'
233
+		);
234
+		return $this->is_broken();
235
+	}
236
+
237
+	/**
238
+	 * Sets the status to as having a fatal error
239
+	 */
240
+	public function set_broken()
241
+	{
242
+		$this->_status = EE_Data_Migration_Manager::status_fatal_error;
243
+	}
244
+
245
+	/**
246
+	 *
247
+	 * @deprecated since 4.6.12
248
+	 */
249
+	public function set_borked()
250
+	{
251
+		EE_Error::doing_it_wrong(
252
+			'is_borked',
253
+			esc_html__(
254
+				'The cheeky "is_borked" method had been replaced with the more proper "is_broken"',
255
+				'event_espresso'
256
+			),
257
+			'4.6.12'
258
+		);
259
+		return $this->set_broken();
260
+	}
261
+
262
+	/**
263
+	 * Checks if this thing believes it is completed
264
+	 *
265
+	 * @return boolean
266
+	 */
267
+	public function is_completed()
268
+	{
269
+		return $this->get_status() == EE_Data_Migration_Manager::status_completed;
270
+	}
271
+
272
+	/**
273
+	 * Checks if the current script has more to do or not (ie, if it's status is CONTINUE)
274
+	 *
275
+	 * @return boolean
276
+	 */
277
+	public function has_more_to_do()
278
+	{
279
+		return $this->get_status() == EE_Data_Migration_Manager::status_continue;
280
+	}
281
+
282
+	/**
283
+	 * Marks that we believe this migration thing is completed
284
+	 */
285
+	public function set_completed()
286
+	{
287
+		$this->_status = EE_Data_Migration_Manager::status_completed;
288
+	}
289
+
290
+	/**
291
+	 * Marks that we think this migration class can continue to migrate
292
+	 */
293
+	public function reattempt()
294
+	{
295
+		$this->_status = EE_Data_Migration_Manager::status_continue;
296
+		$this->add_error(esc_html__('Reattempt migration', 'event_espresso'), true);
297
+	}
298
+
299
+	/**
300
+	 * A lot like "__sleep()" magic method in purpose, this is meant for persisting this class'
301
+	 * properties to the DB. However, we don't want to use __sleep() because its quite
302
+	 * possible that this class is defined when it goes to sleep, but NOT available when it
303
+	 * awakes (eg, this class is part of an addon that is deactivated at some point).
304
+	 */
305
+	public function properties_as_array()
306
+	{
307
+		$properties = get_object_vars($this);
308
+		$properties['class'] = get_class($this);
309
+		unset($properties['_migration_script']);
310
+		unset($properties['_table_manager']);
311
+		unset($properties['_table_analysis']);
312
+		return $properties;
313
+	}
314
+
315
+	/**
316
+	 * Sets all of the properties of this script stage to match what's in the array, which is assumed
317
+	 * to have been made from the properties_as_array() function.
318
+	 *
319
+	 * @param array $array_of_properties like what's produced from properties_as_array() method
320
+	 */
321
+	abstract public function instantiate_from_array_of_properties($array_of_properties);
322
+
323
+	/**
324
+	 * Convenience method for showing a database insertion error
325
+	 *
326
+	 * @param string $old_table
327
+	 * @param array  $old_row_as_array
328
+	 * @param string $new_table
329
+	 * @param array  $new_row_as_array columns=>values like used in wpdb->insert
330
+	 * @param array  $data_types       numerically indexed
331
+	 * @return string
332
+	 */
333
+	protected function _create_error_message_for_db_insertion(
334
+		$old_table,
335
+		$old_row_as_array,
336
+		$new_table,
337
+		$new_row_as_array,
338
+		$data_types
339
+	) {
340
+		global $wpdb;
341
+		$old_columns_and_values_for_string = array();
342
+		foreach ($old_row_as_array as $column => $value) {
343
+			$old_columns_and_values_for_string[] = "$column => $value";
344
+		}
345
+		$new_columns_and_values_for_string = array();
346
+		$count = 0;
347
+		foreach ($new_row_as_array as $column => $value) {
348
+			$new_columns_and_values_for_string[] = " $column => $value (" . $data_types[ $count++ ] . ")";
349
+		}
350
+		return sprintf(
351
+			esc_html__(
352
+				'Received error "%6$s" inserting row %5$s %1$s %5$s into table %2$s.%5$s Data used was %5$s %3$s %5$s from table %4$s.',
353
+				'event_espresso'
354
+			),
355
+			implode(", ", $new_columns_and_values_for_string),
356
+			$new_table,
357
+			implode(", ", $old_columns_and_values_for_string),
358
+			$old_table,
359
+			'<br/>',
360
+			$wpdb->last_error
361
+		);
362
+	}
363
+
364
+
365
+	/**
366
+	 * Same as json_encode, just avoids putting
367
+	 * serialized arrays into the http build query, as that would
368
+	 *
369
+	 * @param array $array_of_data
370
+	 * @return string
371
+	 */
372
+	protected function _json_encode($array_of_data)
373
+	{
374
+		// we'd rather NOT serialize the transaction details
375
+		$fields_to_include = array();
376
+		foreach ($array_of_data as $name => $value) {
377
+			$unserialized_data = @unserialize($value);
378
+			if ($unserialized_data === false) {
379
+				$fields_to_include[ $name ] = $value;
380
+			}
381
+		}
382
+		return wp_json_encode($fields_to_include);
383
+	}
384
+
385
+	/**
386
+	 * Gets the table manager (or throws an exception if it cannot be retrieved)
387
+	 *
388
+	 * @return TableManager
389
+	 * @throws EE_Error
390
+	 */
391
+	protected function _get_table_manager()
392
+	{
393
+		if ($this->_table_manager instanceof TableManager) {
394
+			return $this->_table_manager;
395
+		} else {
396
+			throw new EE_Error(
397
+				sprintf(
398
+					esc_html__('Table manager on migration class %1$s is not set properly.', 'event_espresso'),
399
+					get_class($this)
400
+				)
401
+			);
402
+		}
403
+	}
404
+
405
+	/**
406
+	 * Gets the injected table analyzer, or throws an exception
407
+	 *
408
+	 * @return TableAnalysis
409
+	 * @throws EE_Error
410
+	 */
411
+	protected function _get_table_analysis()
412
+	{
413
+		if ($this->_table_analysis instanceof TableAnalysis) {
414
+			return $this->_table_analysis;
415
+		} else {
416
+			throw new EE_Error(
417
+				sprintf(
418
+					esc_html__('Table analysis class on migration class %1$s is not set properly.', 'event_espresso'),
419
+					get_class($this)
420
+				)
421
+			);
422
+		}
423
+	}
424 424
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function add_error($error, $force = false)
187 187
     {
188
-        if (! defined('EE_DMS_ERROR_LIMIT')) {
188
+        if ( ! defined('EE_DMS_ERROR_LIMIT')) {
189 189
             $limit = 50;
190 190
         } else {
191 191
             $limit = EE_DMS_ERROR_LIMIT;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 $this->_errors[] = "Limit reached; removed first half of errors to save space";
202 202
                 $this->_errors[] = $error;
203 203
             } else {
204
-                $this->_errors[ $limit ] = 'More, but limit reached...';
204
+                $this->_errors[$limit] = 'More, but limit reached...';
205 205
             }
206 206
         } else {
207 207
             $this->_errors[] = $error;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
         $new_columns_and_values_for_string = array();
346 346
         $count = 0;
347 347
         foreach ($new_row_as_array as $column => $value) {
348
-            $new_columns_and_values_for_string[] = " $column => $value (" . $data_types[ $count++ ] . ")";
348
+            $new_columns_and_values_for_string[] = " $column => $value (".$data_types[$count++].")";
349 349
         }
350 350
         return sprintf(
351 351
             esc_html__(
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         foreach ($array_of_data as $name => $value) {
377 377
             $unserialized_data = @unserialize($value);
378 378
             if ($unserialized_data === false) {
379
-                $fields_to_include[ $name ] = $value;
379
+                $fields_to_include[$name] = $value;
380 380
             }
381 381
         }
382 382
         return wp_json_encode($fields_to_include);
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19
-    $matches = array();
20
-    preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-    $class_to_filepath[ $matches[1] ] = $filepath;
19
+	$matches = array();
20
+	preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
+	$class_to_filepath[ $matches[1] ] = $filepath;
22 22
 }
23 23
 // give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -37,69 +37,69 @@  discard block
 block discarded – undo
37 37
 class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base
38 38
 {
39 39
 
40
-    /**
41
-     * return EE_DMS_Core_4_6_0
42
-     *
43
-     * @param TableManager  $table_manager
44
-     * @param TableAnalysis $table_analysis
45
-     */
46
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
47
-    {
48
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.6.0", "event_espresso");
49
-        $this->_priority = 10;
50
-        $this->_migration_stages = array(
51
-            new EE_DMS_4_6_0_gateways(),
52
-            new EE_DMS_4_6_0_question_types(),
53
-            new EE_DMS_4_6_0_country_system_question(),
54
-            new EE_DMS_4_6_0_state_system_question(),
55
-            new EE_DMS_4_6_0_billing_info(),
56
-            new EE_DMS_4_6_0_transactions(),
57
-            new EE_DMS_4_6_0_payments(),
58
-            new EE_DMS_4_6_0_invoice_settings(),
59
-        );
60
-        parent::__construct($table_manager, $table_analysis);
61
-    }
40
+	/**
41
+	 * return EE_DMS_Core_4_6_0
42
+	 *
43
+	 * @param TableManager  $table_manager
44
+	 * @param TableAnalysis $table_analysis
45
+	 */
46
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
47
+	{
48
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.6.0", "event_espresso");
49
+		$this->_priority = 10;
50
+		$this->_migration_stages = array(
51
+			new EE_DMS_4_6_0_gateways(),
52
+			new EE_DMS_4_6_0_question_types(),
53
+			new EE_DMS_4_6_0_country_system_question(),
54
+			new EE_DMS_4_6_0_state_system_question(),
55
+			new EE_DMS_4_6_0_billing_info(),
56
+			new EE_DMS_4_6_0_transactions(),
57
+			new EE_DMS_4_6_0_payments(),
58
+			new EE_DMS_4_6_0_invoice_settings(),
59
+		);
60
+		parent::__construct($table_manager, $table_analysis);
61
+	}
62 62
 
63 63
 
64 64
 
65
-    /**
66
-     * @param array $version_array
67
-     * @return bool
68
-     */
69
-    public function can_migrate_from_version($version_array)
70
-    {
71
-        $version_string = $version_array['Core'];
72
-        if (version_compare($version_string, '4.6.0.decaf', '<') && version_compare($version_string, '4.5.0.decaf', '>=')) {
65
+	/**
66
+	 * @param array $version_array
67
+	 * @return bool
68
+	 */
69
+	public function can_migrate_from_version($version_array)
70
+	{
71
+		$version_string = $version_array['Core'];
72
+		if (version_compare($version_string, '4.6.0.decaf', '<') && version_compare($version_string, '4.5.0.decaf', '>=')) {
73 73
 //          echo "$version_string can be migrated from";
74
-            return true;
75
-        } elseif (! $version_string) {
74
+			return true;
75
+		} elseif (! $version_string) {
76 76
 //          echo "no version string provided: $version_string";
77
-            // no version string provided... this must be pre 4.3
78
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
79
-        } else {
77
+			// no version string provided... this must be pre 4.3
78
+			return false;// changed mind. dont want people thinking they should migrate yet because they cant
79
+		} else {
80 80
 //          echo "$version_string doesnt apply";
81
-            return false;
82
-        }
83
-    }
81
+			return false;
82
+		}
83
+	}
84 84
 
85 85
 
86 86
 
87
-    /**
88
-     * @return bool
89
-     */
90
-    public function schema_changes_before_migration()
91
-    {
92
-        // relies on 4.1's EEH_Activation::create_table
93
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
94
-        $table_name = 'esp_answer';
95
-        $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
87
+	/**
88
+	 * @return bool
89
+	 */
90
+	public function schema_changes_before_migration()
91
+	{
92
+		// relies on 4.1's EEH_Activation::create_table
93
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
94
+		$table_name = 'esp_answer';
95
+		$sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
96 96
 					REG_ID int(10) unsigned NOT NULL,
97 97
 					QST_ID int(10) unsigned NOT NULL,
98 98
 					ANS_value text NOT NULL,
99 99
 					PRIMARY KEY  (ANS_ID)";
100
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
101
-        $table_name = 'esp_attendee_meta';
102
-        $sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
100
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
101
+		$table_name = 'esp_attendee_meta';
102
+		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
103 103
 						ATT_ID bigint(20) unsigned NOT NULL,
104 104
 						ATT_fname varchar(45) NOT NULL,
105 105
 						ATT_lname varchar(45) NOT	NULL,
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 								KEY ATT_fname (ATT_fname),
116 116
 								KEY ATT_lname (ATT_lname),
117 117
 								KEY ATT_email (ATT_email(191))";
118
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
119
-        $table_name = 'esp_country';
120
-        $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL,
118
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
119
+		$table_name = 'esp_country';
120
+		$sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL,
121 121
 					  CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL,
122 122
 					  RGN_ID tinyint(3) unsigned DEFAULT NULL,
123 123
 					  CNT_name varchar(45) COLLATE utf8_bin NOT NULL,
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
 					  CNT_is_EU tinyint(1) DEFAULT '0',
134 134
 					  CNT_active tinyint(1) DEFAULT '0',
135 135
 					  PRIMARY KEY  (CNT_ISO)";
136
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
137
-        $table_name = 'esp_currency';
138
-        $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL,
136
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
137
+		$table_name = 'esp_currency';
138
+		$sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL,
139 139
 				CUR_single varchar(45) COLLATE utf8_bin DEFAULT 'dollar',
140 140
 				CUR_plural varchar(45) COLLATE utf8_bin DEFAULT 'dollars',
141 141
 				CUR_sign varchar(45) COLLATE utf8_bin DEFAULT '$',
142 142
 				CUR_dec_plc varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
143 143
 				CUR_active tinyint(1) DEFAULT '0',
144 144
 				PRIMARY KEY  (CUR_code)";
145
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
146
-        $table_name = 'esp_currency_payment_method';
147
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
145
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
146
+		$table_name = 'esp_currency_payment_method';
147
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
148 148
 				CUR_code varchar(6) COLLATE utf8_bin NOT NULL,
149 149
 				PMD_ID int(11) NOT NULL,
150 150
 				PRIMARY KEY  (CPM_ID)";
151
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
152
-        $table_name = 'esp_datetime';
153
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
151
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
152
+		$table_name = 'esp_datetime';
153
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
154 154
 				  EVT_ID bigint(20) unsigned NOT NULL,
155 155
 				  DTT_name varchar(255) NOT NULL DEFAULT '',
156 156
 				  DTT_description text NOT NULL,
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 						PRIMARY KEY  (DTT_ID),
166 166
 						KEY EVT_ID (EVT_ID),
167 167
 						KEY DTT_is_primary (DTT_is_primary)";
168
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
-        $table_name = 'esp_event_meta';
170
-        $sql = "
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
+		$table_name = 'esp_event_meta';
170
+		$sql = "
171 171
 			EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
172 172
 			EVT_ID bigint(20) unsigned NOT NULL,
173 173
 			EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -182,31 +182,31 @@  discard block
 block discarded – undo
182 182
 			EVT_external_URL varchar(200) NULL,
183 183
 			EVT_donations tinyint(1) NULL,
184 184
 			PRIMARY KEY  (EVTM_ID)";
185
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
186
-        $table_name = 'esp_event_question_group';
187
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
185
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
186
+		$table_name = 'esp_event_question_group';
187
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
188 188
 					EVT_ID bigint(20) unsigned NOT NULL,
189 189
 					QSG_ID int(10) unsigned NOT NULL,
190 190
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
191 191
 					PRIMARY KEY  (EQG_ID)";
192
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
193
-        $table_name = 'esp_event_venue';
194
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
192
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
193
+		$table_name = 'esp_event_venue';
194
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
195 195
 				EVT_ID bigint(20) unsigned NOT NULL,
196 196
 				VNU_ID bigint(20) unsigned NOT NULL,
197 197
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
198 198
 				PRIMARY KEY  (EVV_ID)";
199
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
200
-        $table_name = 'esp_extra_meta';
201
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
199
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
200
+		$table_name = 'esp_extra_meta';
201
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
202 202
 				OBJ_ID int(11) DEFAULT NULL,
203 203
 				EXM_type varchar(45) DEFAULT NULL,
204 204
 				EXM_key varchar(45) DEFAULT NULL,
205 205
 				EXM_value text,
206 206
 				PRIMARY KEY  (EXM_ID)";
207
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
208
-        $table_name = 'esp_line_item';
209
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
207
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
208
+		$table_name = 'esp_line_item';
209
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
210 210
 				LIN_code varchar(245) NOT NULL DEFAULT '',
211 211
 				TXN_ID int(11) DEFAULT NULL,
212 212
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 				OBJ_ID int(11) DEFAULT NULL,
223 223
 				OBJ_type varchar(45)DEFAULT NULL,
224 224
 				PRIMARY KEY  (LIN_ID)";
225
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
226
-        $table_name = 'esp_log';
227
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
225
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
226
+		$table_name = 'esp_log';
227
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
228 228
 				LOG_time datetime DEFAULT NULL,
229 229
 				OBJ_ID varchar(45) DEFAULT NULL,
230 230
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -232,19 +232,19 @@  discard block
 block discarded – undo
232 232
 				LOG_message text,
233 233
 				LOG_wp_user int(11) DEFAULT NULL,
234 234
 				PRIMARY KEY  (LOG_ID)";
235
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
236
-        $table_name = 'esp_message_template';
237
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
235
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
236
+		$table_name = 'esp_message_template';
237
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
238 238
 					GRP_ID int(10) unsigned NOT NULL,
239 239
 					MTP_context varchar(50) NOT NULL,
240 240
 					MTP_template_field varchar(30) NOT NULL,
241 241
 					MTP_content text NOT NULL,
242 242
 					PRIMARY KEY  (MTP_ID),
243 243
 					KEY GRP_ID (GRP_ID)";
244
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
245
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
246
-        $table_name = 'esp_message_template_group';
247
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
244
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
245
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
246
+		$table_name = 'esp_message_template_group';
247
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
248 248
 					MTP_user_id int(10) NOT NULL DEFAULT '1',
249 249
 					MTP_name varchar(245) NOT NULL DEFAULT '',
250 250
 					MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -256,17 +256,17 @@  discard block
 block discarded – undo
256 256
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
257 257
 					PRIMARY KEY  (GRP_ID),
258 258
 					KEY MTP_user_id (MTP_user_id)";
259
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
260
-        $table_name = 'esp_event_message_template';
261
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
259
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
260
+		$table_name = 'esp_event_message_template';
261
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
262 262
 					EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
263 263
 					GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
264 264
 					PRIMARY KEY  (EMT_ID),
265 265
 					KEY EVT_ID (EVT_ID),
266 266
 					KEY GRP_ID (GRP_ID)";
267
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
268
-        $table_name = 'esp_payment';
269
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
267
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
268
+		$table_name = 'esp_payment';
269
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
270 270
 					TXN_ID int(10) unsigned DEFAULT NULL,
271 271
 					STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL,
272 272
 					PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 					PRIMARY KEY  (PAY_ID),
284 284
 					KEY TXN_ID (TXN_ID),
285 285
 					KEY PAY_timestamp (PAY_timestamp)";
286
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
287
-        $table_name = 'esp_payment_method';
288
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
286
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
287
+		$table_name = 'esp_payment_method';
288
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
289 289
 				PMD_type varchar(124) DEFAULT NULL,
290 290
 				PMD_name varchar(255) DEFAULT NULL,
291 291
 				PMD_desc text,
@@ -300,28 +300,28 @@  discard block
 block discarded – undo
300 300
 				PMD_scope varchar(255) NULL DEFAULT 'frontend',
301 301
 				PRIMARY KEY  (PMD_ID),
302 302
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)";
303
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
304
-        $table_name = "esp_ticket_price";
305
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
303
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
304
+		$table_name = "esp_ticket_price";
305
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
306 306
 					  TKT_ID int(10) unsigned NOT NULL,
307 307
 					  PRC_ID int(10) unsigned NOT NULL,
308 308
 					  PRIMARY KEY  (TKP_ID)";
309
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
310
-        $table_name = "esp_datetime_ticket";
311
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
309
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
310
+		$table_name = "esp_datetime_ticket";
311
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
312 312
 					  DTT_ID int(10) unsigned NOT NULL,
313 313
 					  TKT_ID int(10) unsigned NOT NULL,
314 314
 					  PRIMARY KEY  (DTK_ID)";
315
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
316
-        $table_name = "esp_ticket_template";
317
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
315
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
316
+		$table_name = "esp_ticket_template";
317
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
318 318
 					  TTM_name varchar(45) NOT NULL,
319 319
 					  TTM_description text,
320 320
 					  TTM_file varchar(45),
321 321
 					  PRIMARY KEY  (TTM_ID)";
322
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
323
-        $table_name = 'esp_question';
324
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
322
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
323
+		$table_name = 'esp_question';
324
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
325 325
 					QST_display_text text NOT NULL,
326 326
 					QST_admin_label varchar(255) NOT NULL,
327 327
 					QST_system varchar(25) DEFAULT NULL,
@@ -333,25 +333,25 @@  discard block
 block discarded – undo
333 333
 					QST_wp_user bigint(20) unsigned NULL,
334 334
 					QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0,
335 335
 					PRIMARY KEY  (QST_ID)';
336
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
337
-        $table_name = 'esp_question_group_question';
338
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
336
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
337
+		$table_name = 'esp_question_group_question';
338
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
339 339
 					QSG_ID int(10) unsigned NOT NULL,
340 340
 					QST_ID int(10) unsigned NOT NULL,
341 341
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
342 342
 					PRIMARY KEY  (QGQ_ID) ";
343
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
344
-        $table_name = 'esp_question_option';
345
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
343
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
344
+		$table_name = 'esp_question_option';
345
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
346 346
 					QSO_value varchar(255) NOT NULL,
347 347
 					QSO_desc text NOT NULL,
348 348
 					QST_ID int(10) unsigned NOT NULL,
349 349
 					QSO_order int(10) unsigned NOT NULL DEFAULT 0,
350 350
 					QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0,
351 351
 					PRIMARY KEY  (QSO_ID)";
352
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
353
-        $table_name = 'esp_registration';
354
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
352
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
353
+		$table_name = 'esp_registration';
354
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
355 355
 					  EVT_ID bigint(20) unsigned NOT NULL,
356 356
 					  ATT_ID bigint(20) unsigned NOT NULL,
357 357
 					  TXN_ID int(10) unsigned NOT NULL,
@@ -374,25 +374,25 @@  discard block
 block discarded – undo
374 374
 					  KEY STS_ID (STS_ID),
375 375
 					  KEY REG_url_link (REG_url_link),
376 376
 					  KEY REG_code (REG_code)";
377
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
378
-        $table_name = 'esp_checkin';
379
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
377
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
378
+		$table_name = 'esp_checkin';
379
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
380 380
 					REG_ID int(10) unsigned NOT NULL,
381 381
 					DTT_ID int(10) unsigned NOT NULL,
382 382
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
383 383
 					CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
384 384
 					PRIMARY KEY  (CHK_ID)";
385
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
386
-        $table_name = 'esp_state';
387
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
385
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
386
+		$table_name = 'esp_state';
387
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
388 388
 					  CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL,
389 389
 					  STA_abbrev varchar(24) COLLATE utf8_bin NOT NULL,
390 390
 					  STA_name varchar(100) COLLATE utf8_bin NOT NULL,
391 391
 					  STA_active tinyint(1) DEFAULT '1',
392 392
 					  PRIMARY KEY  (STA_ID)";
393
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
394
-        $table_name = 'esp_status';
395
-        $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL,
393
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
394
+		$table_name = 'esp_status';
395
+		$sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL,
396 396
 					  STS_code varchar(45) COLLATE utf8_bin NOT NULL,
397 397
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
398 398
 					  STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 					  STS_open tinyint(1) NOT NULL DEFAULT 1,
401 401
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
402 402
 					  KEY STS_type (STS_type)";
403
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
404
-        $table_name = 'esp_transaction';
405
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
403
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
404
+		$table_name = 'esp_transaction';
405
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
406 406
 					  TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
407 407
 					  TXN_total decimal(10,3) DEFAULT '0.00',
408 408
 					  TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 					  PRIMARY KEY  (TXN_ID),
415 415
 					  KEY TXN_timestamp (TXN_timestamp),
416 416
 					  KEY STS_ID (STS_ID)";
417
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
418
-        $table_name = 'esp_venue_meta';
419
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
417
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
418
+		$table_name = 'esp_venue_meta';
419
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
420 420
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
421 421
 			VNU_address varchar(255) DEFAULT NULL,
422 422
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 			PRIMARY KEY  (VNUM_ID),
435 435
 			KEY STA_ID (STA_ID),
436 436
 			KEY CNT_ISO (CNT_ISO)";
437
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
438
-        // modified tables
439
-        $table_name = "esp_price";
440
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
437
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
438
+		// modified tables
439
+		$table_name = "esp_price";
440
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
441 441
 					  PRT_ID tinyint(3) unsigned NOT NULL,
442 442
 					  PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
443 443
 					  PRC_name varchar(245) NOT NULL,
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 					  PRC_wp_user bigint(20) unsigned NULL,
450 450
 					  PRC_parent int(10) unsigned DEFAULT 0,
451 451
 					  PRIMARY KEY  (PRC_ID)";
452
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
453
-        $table_name = "esp_price_type";
454
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
452
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
453
+		$table_name = "esp_price_type";
454
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
455 455
 				  PRT_name varchar(45) NOT NULL,
456 456
 				  PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
457 457
 				  PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
 				  PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
461 461
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
462 462
 				  PRIMARY KEY  (PRT_ID)";
463
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
464
-        $table_name = "esp_ticket";
465
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
463
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
464
+		$table_name = "esp_ticket";
465
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
466 466
 					  TTM_ID int(10) unsigned NOT NULL,
467 467
 					  TKT_name varchar(245) NOT NULL DEFAULT '',
468 468
 					  TKT_description text NOT NULL,
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
 					  TKT_parent int(10) unsigned DEFAULT '0',
484 484
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
485 485
 					  PRIMARY KEY  (TKT_ID)";
486
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
487
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
488
-        $table_name = 'esp_question_group';
489
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
486
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
487
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
488
+		$table_name = 'esp_question_group';
489
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
490 490
 					QSG_name varchar(255) NOT NULL,
491 491
 					QSG_identifier varchar(100) NOT NULL,
492 492
 					QSG_desc text NULL,
@@ -498,124 +498,124 @@  discard block
 block discarded – undo
498 498
 					QSG_wp_user bigint(20) unsigned NULL,
499 499
 					PRIMARY KEY  (QSG_ID),
500 500
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
501
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
502
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
503
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
504
-        // (because many need to convert old string states to foreign keys into the states table)
505
-        $script_4_1_defaults->insert_default_states();
506
-        $script_4_1_defaults->insert_default_countries();
507
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
508
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
509
-        $script_4_5_defaults->insert_default_price_types();
510
-        $script_4_5_defaults->insert_default_prices();
511
-        $script_4_5_defaults->insert_default_tickets();
512
-        // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
513
-        EE_Config::instance()->update_espresso_config(false, true);
514
-        $this->add_default_admin_only_payments();
515
-        $this->insert_default_currencies();
516
-        return true;
517
-    }
501
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
502
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
503
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
504
+		// (because many need to convert old string states to foreign keys into the states table)
505
+		$script_4_1_defaults->insert_default_states();
506
+		$script_4_1_defaults->insert_default_countries();
507
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
508
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
509
+		$script_4_5_defaults->insert_default_price_types();
510
+		$script_4_5_defaults->insert_default_prices();
511
+		$script_4_5_defaults->insert_default_tickets();
512
+		// setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
513
+		EE_Config::instance()->update_espresso_config(false, true);
514
+		$this->add_default_admin_only_payments();
515
+		$this->insert_default_currencies();
516
+		return true;
517
+	}
518 518
 
519 519
 
520 520
 
521
-    /**
522
-     * @return boolean
523
-     */
524
-    public function schema_changes_after_migration()
525
-    {
526
-        return true;
527
-    }
521
+	/**
522
+	 * @return boolean
523
+	 */
524
+	public function schema_changes_after_migration()
525
+	{
526
+		return true;
527
+	}
528 528
 
529 529
 
530 530
 
531
-    public function migration_page_hooks()
532
-    {
533
-    }
531
+	public function migration_page_hooks()
532
+	{
533
+	}
534 534
 
535 535
 
536 536
 
537
-    public function add_default_admin_only_payments()
538
-    {
539
-        global $wpdb;
540
-        $table_name = $wpdb->prefix . "esp_payment_method";
541
-        $user_id = EEH_Activation::get_default_creator_id();
542
-        if ($this->_get_table_analysis()->tableExists($table_name)) {
543
-            $SQL = "SELECT COUNT( * ) FROM $table_name";
544
-            $existing_payment_methods = $wpdb->get_var($SQL);
545
-            $default_admin_only_payment_methods = apply_filters(
546
-                'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
547
-                array(
548
-                    (string) esc_html__("Bank", 'event_espresso')        => esc_html__("Bank Draft", 'event_espresso'),
549
-                    (string) esc_html__("Cash", 'event_espresso')        => esc_html__("Cash Delivered Physically", 'event_espresso'),
550
-                    (string) esc_html__("Check", 'event_espresso')       => esc_html__("Paper Check", 'event_espresso'),
551
-                    (string) esc_html__("Credit Card", 'event_espresso') => esc_html__("Offline Credit Card Payment", 'event_espresso'),
552
-                    (string) esc_html__("Debit Card", 'event_espresso')  => esc_html__("Offline Debit Payment", 'event_espresso'),
553
-                    (string) esc_html__("Invoice", 'event_espresso')     => esc_html__(
554
-                        "Invoice received with monies included",
555
-                        'event_espresso'
556
-                    ),
557
-                    (string) esc_html__("Money Order", 'event_espresso') => '',
558
-                    (string) esc_html__("Paypal", 'event_espresso')      => esc_html__("Paypal eCheck, Invoice, etc", 'event_espresso'),
559
-                    (string) esc_html__('Other', 'event_espresso')       => esc_html__('Other method of payment', 'event_espresso'),
560
-                )
561
-            );
562
-            // make sure we hae payment method records for the following
563
-            // so admins can record payments for them from the admin page
564
-            foreach ($default_admin_only_payment_methods as $nicename => $description) {
565
-                $slug = sanitize_key($nicename);
566
-                // check that such a payment method exists
567
-                $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
568
-                if (! $exists) {
569
-                    $values = array(
570
-                        'PMD_type'       => 'Admin_Only',
571
-                        'PMD_name'       => $nicename,
572
-                        'PMD_admin_name' => $nicename,
573
-                        'PMD_admin_desc' => $description,
574
-                        'PMD_slug'       => $slug,
575
-                        'PMD_wp_user'    => $user_id,
576
-                        'PMD_scope'      => serialize(array('ADMIN')),
577
-                    );
578
-                    $success = $wpdb->insert(
579
-                        $table_name,
580
-                        $values,
581
-                        array(
582
-                            '%s',// PMD_type
583
-                            '%s',// PMD_name
584
-                            '%s',// PMD_admin_name
585
-                            '%s',// PMD_admin_desc
586
-                            '%s',// PMD_slug
587
-                            '%d',// PMD_wp_user
588
-                            '%s',// PMD_scope
589
-                        )
590
-                    );
591
-                    if (! $success) {
592
-                        $this->add_error(sprintf(esc_html__(
593
-                            "Could not insert new admin-only payment method with values %s during migration",
594
-                            "event_espresso"
595
-                        ), $this->_json_encode($values)));
596
-                    }
597
-                }
598
-            }
599
-        }
600
-    }
537
+	public function add_default_admin_only_payments()
538
+	{
539
+		global $wpdb;
540
+		$table_name = $wpdb->prefix . "esp_payment_method";
541
+		$user_id = EEH_Activation::get_default_creator_id();
542
+		if ($this->_get_table_analysis()->tableExists($table_name)) {
543
+			$SQL = "SELECT COUNT( * ) FROM $table_name";
544
+			$existing_payment_methods = $wpdb->get_var($SQL);
545
+			$default_admin_only_payment_methods = apply_filters(
546
+				'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
547
+				array(
548
+					(string) esc_html__("Bank", 'event_espresso')        => esc_html__("Bank Draft", 'event_espresso'),
549
+					(string) esc_html__("Cash", 'event_espresso')        => esc_html__("Cash Delivered Physically", 'event_espresso'),
550
+					(string) esc_html__("Check", 'event_espresso')       => esc_html__("Paper Check", 'event_espresso'),
551
+					(string) esc_html__("Credit Card", 'event_espresso') => esc_html__("Offline Credit Card Payment", 'event_espresso'),
552
+					(string) esc_html__("Debit Card", 'event_espresso')  => esc_html__("Offline Debit Payment", 'event_espresso'),
553
+					(string) esc_html__("Invoice", 'event_espresso')     => esc_html__(
554
+						"Invoice received with monies included",
555
+						'event_espresso'
556
+					),
557
+					(string) esc_html__("Money Order", 'event_espresso') => '',
558
+					(string) esc_html__("Paypal", 'event_espresso')      => esc_html__("Paypal eCheck, Invoice, etc", 'event_espresso'),
559
+					(string) esc_html__('Other', 'event_espresso')       => esc_html__('Other method of payment', 'event_espresso'),
560
+				)
561
+			);
562
+			// make sure we hae payment method records for the following
563
+			// so admins can record payments for them from the admin page
564
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
565
+				$slug = sanitize_key($nicename);
566
+				// check that such a payment method exists
567
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
568
+				if (! $exists) {
569
+					$values = array(
570
+						'PMD_type'       => 'Admin_Only',
571
+						'PMD_name'       => $nicename,
572
+						'PMD_admin_name' => $nicename,
573
+						'PMD_admin_desc' => $description,
574
+						'PMD_slug'       => $slug,
575
+						'PMD_wp_user'    => $user_id,
576
+						'PMD_scope'      => serialize(array('ADMIN')),
577
+					);
578
+					$success = $wpdb->insert(
579
+						$table_name,
580
+						$values,
581
+						array(
582
+							'%s',// PMD_type
583
+							'%s',// PMD_name
584
+							'%s',// PMD_admin_name
585
+							'%s',// PMD_admin_desc
586
+							'%s',// PMD_slug
587
+							'%d',// PMD_wp_user
588
+							'%s',// PMD_scope
589
+						)
590
+					);
591
+					if (! $success) {
592
+						$this->add_error(sprintf(esc_html__(
593
+							"Could not insert new admin-only payment method with values %s during migration",
594
+							"event_espresso"
595
+						), $this->_json_encode($values)));
596
+					}
597
+				}
598
+			}
599
+		}
600
+	}
601 601
 
602 602
 
603 603
 
604
-    /**
605
-     * insert_default_countries
606
-     *
607
-     * @static
608
-     * @return void
609
-     */
610
-    public function insert_default_currencies()
611
-    {
612
-        global $wpdb;
613
-        $currency_table = $wpdb->prefix . "esp_currency";
614
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
615
-            $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
616
-            $countries = $wpdb->get_var($SQL);
617
-            if (! $countries) {
618
-                $SQL = "INSERT INTO $currency_table
604
+	/**
605
+	 * insert_default_countries
606
+	 *
607
+	 * @static
608
+	 * @return void
609
+	 */
610
+	public function insert_default_currencies()
611
+	{
612
+		global $wpdb;
613
+		$currency_table = $wpdb->prefix . "esp_currency";
614
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
615
+			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
616
+			$countries = $wpdb->get_var($SQL);
617
+			if (! $countries) {
618
+				$SQL = "INSERT INTO $currency_table
619 619
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
620 620
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
621 621
 				( 'AED',  'Dirham',  'Dirhams', 'د.إ',2,1),
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 				( 'ZAR',  'Rand',  'Rands',  'R',  2,1),
770 770
 				( 'ZMK',  'Kwacha',  'Kwachas',  '',  2,1),
771 771
 				( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);";
772
-                $wpdb->query($SQL);
773
-            }
774
-        }
775
-    }
772
+				$wpdb->query($SQL);
773
+			}
774
+		}
775
+	}
776 776
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 // unfortunately, this needs to be done upon INCLUSION of this file,
14 14
 // instead of construction, because it only gets constructed on first page load
15 15
 // (all other times it gets resurrected from a wordpress option)
16
-$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
16
+$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19 19
     $matches = array();
20 20
     preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-    $class_to_filepath[ $matches[1] ] = $filepath;
21
+    $class_to_filepath[$matches[1]] = $filepath;
22 22
 }
23 23
 // give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
         if (version_compare($version_string, '4.6.0.decaf', '<') && version_compare($version_string, '4.5.0.decaf', '>=')) {
73 73
 //          echo "$version_string can be migrated from";
74 74
             return true;
75
-        } elseif (! $version_string) {
75
+        } elseif ( ! $version_string) {
76 76
 //          echo "no version string provided: $version_string";
77 77
             // no version string provided... this must be pre 4.3
78
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
78
+            return false; // changed mind. dont want people thinking they should migrate yet because they cant
79 79
         } else {
80 80
 //          echo "$version_string doesnt apply";
81 81
             return false;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     public function schema_changes_before_migration()
91 91
     {
92 92
         // relies on 4.1's EEH_Activation::create_table
93
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
94 94
         $table_name = 'esp_answer';
95 95
         $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
96 96
 					REG_ID int(10) unsigned NOT NULL,
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     public function add_default_admin_only_payments()
538 538
     {
539 539
         global $wpdb;
540
-        $table_name = $wpdb->prefix . "esp_payment_method";
540
+        $table_name = $wpdb->prefix."esp_payment_method";
541 541
         $user_id = EEH_Activation::get_default_creator_id();
542 542
         if ($this->_get_table_analysis()->tableExists($table_name)) {
543 543
             $SQL = "SELECT COUNT( * ) FROM $table_name";
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                 $slug = sanitize_key($nicename);
566 566
                 // check that such a payment method exists
567 567
                 $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
568
-                if (! $exists) {
568
+                if ( ! $exists) {
569 569
                     $values = array(
570 570
                         'PMD_type'       => 'Admin_Only',
571 571
                         'PMD_name'       => $nicename,
@@ -579,16 +579,16 @@  discard block
 block discarded – undo
579 579
                         $table_name,
580 580
                         $values,
581 581
                         array(
582
-                            '%s',// PMD_type
583
-                            '%s',// PMD_name
584
-                            '%s',// PMD_admin_name
585
-                            '%s',// PMD_admin_desc
586
-                            '%s',// PMD_slug
587
-                            '%d',// PMD_wp_user
588
-                            '%s',// PMD_scope
582
+                            '%s', // PMD_type
583
+                            '%s', // PMD_name
584
+                            '%s', // PMD_admin_name
585
+                            '%s', // PMD_admin_desc
586
+                            '%s', // PMD_slug
587
+                            '%d', // PMD_wp_user
588
+                            '%s', // PMD_scope
589 589
                         )
590 590
                     );
591
-                    if (! $success) {
591
+                    if ( ! $success) {
592 592
                         $this->add_error(sprintf(esc_html__(
593 593
                             "Could not insert new admin-only payment method with values %s during migration",
594 594
                             "event_espresso"
@@ -610,11 +610,11 @@  discard block
 block discarded – undo
610 610
     public function insert_default_currencies()
611 611
     {
612 612
         global $wpdb;
613
-        $currency_table = $wpdb->prefix . "esp_currency";
613
+        $currency_table = $wpdb->prefix."esp_currency";
614 614
         if ($this->_get_table_analysis()->tableExists($currency_table)) {
615 615
             $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
616 616
             $countries = $wpdb->get_var($SQL);
617
-            if (! $countries) {
617
+            if ( ! $countries) {
618 618
                 $SQL = "INSERT INTO $currency_table
619 619
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
620 620
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
Please login to merge, or discard this patch.
4_3_0_stages/EE_DMS_4_3_0_event_message_templates.dmsstage.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,59 +13,59 @@
 block discarded – undo
13 13
 class EE_DMS_4_3_0_event_message_templates extends EE_Data_Migration_Script_Stage_Table
14 14
 {
15 15
 
16
-    /**
17
-     * This property will hold the table name for event_message_templates
18
-     * @var string
19
-     */
20
-    private $_emt_table;
16
+	/**
17
+	 * This property will hold the table name for event_message_templates
18
+	 * @var string
19
+	 */
20
+	private $_emt_table;
21 21
 
22 22
 
23
-    public function __construct()
24
-    {
25
-        global $wpdb;
26
-        $this->_pretty_name = esc_html__('Event Message Templates', 'event_espresso');
27
-        $this->_old_table = $wpdb->prefix . "esp_message_template_group";
28
-        $this->_emt_table = $wpdb->prefix . "esp_event_message_template";
29
-        parent::__construct();
30
-    }
23
+	public function __construct()
24
+	{
25
+		global $wpdb;
26
+		$this->_pretty_name = esc_html__('Event Message Templates', 'event_espresso');
27
+		$this->_old_table = $wpdb->prefix . "esp_message_template_group";
28
+		$this->_emt_table = $wpdb->prefix . "esp_event_message_template";
29
+		parent::__construct();
30
+	}
31 31
 
32 32
 
33 33
 
34
-    protected function _migrate_old_row($old_row)
35
-    {
36
-        // foreach row that has an evt_id ..let's create an equivalent entry in the new event_messages_template table to link the message template to the event (since EVT_ID is no longer referenced in esp_message_template_groups )
37
-        global $wpdb;
38
-        if ($old_row['EVT_ID'] > 0) {
39
-                                    // let's get the EVT for this id so we can update the custom name on the old row.
40
-                                    $event_name = 'Custom Template for ' . $wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
34
+	protected function _migrate_old_row($old_row)
35
+	{
36
+		// foreach row that has an evt_id ..let's create an equivalent entry in the new event_messages_template table to link the message template to the event (since EVT_ID is no longer referenced in esp_message_template_groups )
37
+		global $wpdb;
38
+		if ($old_row['EVT_ID'] > 0) {
39
+									// let's get the EVT for this id so we can update the custom name on the old row.
40
+									$event_name = 'Custom Template for ' . $wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
41 41
 
42
-                                    // update name
43
-                                    $updated = $wpdb->update(
44
-                                        $this->_old_table,
45
-                                        array(
46
-                                            'MTP_name' => $event_name
47
-                                            ),
48
-                                        array( 'GRP_ID' => (int) $old_row['GRP_ID'] ),
49
-                                        array( '%s' ),
50
-                                        array( '%d' )
51
-                                    );
42
+									// update name
43
+									$updated = $wpdb->update(
44
+										$this->_old_table,
45
+										array(
46
+											'MTP_name' => $event_name
47
+											),
48
+										array( 'GRP_ID' => (int) $old_row['GRP_ID'] ),
49
+										array( '%s' ),
50
+										array( '%d' )
51
+									);
52 52
 
53
-            $inserted = $wpdb->insert(
54
-                $this->_emt_table,
55
-                array(
56
-                    'EVT_ID' => (int) $old_row['EVT_ID'],
57
-                    'GRP_ID' => (int) $old_row['GRP_ID'],
58
-                    ),
59
-                array( '%d', '%d' )
60
-            );
53
+			$inserted = $wpdb->insert(
54
+				$this->_emt_table,
55
+				array(
56
+					'EVT_ID' => (int) $old_row['EVT_ID'],
57
+					'GRP_ID' => (int) $old_row['GRP_ID'],
58
+					),
59
+				array( '%d', '%d' )
60
+			);
61 61
 
62
-            if (false === $updated) {
63
-                $this->add_error(sprintf(esc_html__("Error in updating the row in %s setting 'MTP_name = %s", 'event_espresso'), $this->_old_table, $event_name));
64
-            }
62
+			if (false === $updated) {
63
+				$this->add_error(sprintf(esc_html__("Error in updating the row in %s setting 'MTP_name = %s", 'event_espresso'), $this->_old_table, $event_name));
64
+			}
65 65
 
66
-            if (false === $inserted) {
67
-                $this->add_error(sprintf(esc_html__("Error in inserting a row into  setting EVT_ID = %d and GRP_ID = %d", "event_espresso"), $this->_emt_table, $old_row['EVT_ID'], $old_row['GRP_ID']));
68
-            }
69
-        }
70
-    }
66
+			if (false === $inserted) {
67
+				$this->add_error(sprintf(esc_html__("Error in inserting a row into  setting EVT_ID = %d and GRP_ID = %d", "event_espresso"), $this->_emt_table, $old_row['EVT_ID'], $old_row['GRP_ID']));
68
+			}
69
+		}
70
+	}
71 71
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     {
25 25
         global $wpdb;
26 26
         $this->_pretty_name = esc_html__('Event Message Templates', 'event_espresso');
27
-        $this->_old_table = $wpdb->prefix . "esp_message_template_group";
28
-        $this->_emt_table = $wpdb->prefix . "esp_event_message_template";
27
+        $this->_old_table = $wpdb->prefix."esp_message_template_group";
28
+        $this->_emt_table = $wpdb->prefix."esp_event_message_template";
29 29
         parent::__construct();
30 30
     }
31 31
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         global $wpdb;
38 38
         if ($old_row['EVT_ID'] > 0) {
39 39
                                     // let's get the EVT for this id so we can update the custom name on the old row.
40
-                                    $event_name = 'Custom Template for ' . $wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
40
+                                    $event_name = 'Custom Template for '.$wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
41 41
 
42 42
                                     // update name
43 43
                                     $updated = $wpdb->update(
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
                                         array(
46 46
                                             'MTP_name' => $event_name
47 47
                                             ),
48
-                                        array( 'GRP_ID' => (int) $old_row['GRP_ID'] ),
49
-                                        array( '%s' ),
50
-                                        array( '%d' )
48
+                                        array('GRP_ID' => (int) $old_row['GRP_ID']),
49
+                                        array('%s'),
50
+                                        array('%d')
51 51
                                     );
52 52
 
53 53
             $inserted = $wpdb->insert(
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                     'EVT_ID' => (int) $old_row['EVT_ID'],
57 57
                     'GRP_ID' => (int) $old_row['GRP_ID'],
58 58
                     ),
59
-                array( '%d', '%d' )
59
+                array('%d', '%d')
60 60
             );
61 61
 
62 62
             if (false === $updated) {
Please login to merge, or discard this patch.
4_3_0_stages/EE_DMS_4_3_0_question_option_order.dmsstage.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,39 +7,39 @@
 block discarded – undo
7 7
 
8 8
 class EE_DMS_4_3_0_question_option_order extends EE_Data_Migration_Script_Stage_Table
9 9
 {
10
-    public function __construct()
11
-    {
12
-        global $wpdb;
13
-        $this->_pretty_name = esc_html__("Question Options", "event_espresso");
14
-        $this->_old_table = $wpdb->prefix . "esp_question_option";
15
-        parent::__construct();
16
-    }
17
-    protected function _migrate_old_row($old_row)
18
-    {
19
-        // foreach question_group_question entry with this QST_ID, we want to set its
20
-        // QSG_order equal to this question's QST_order
21
-        global $wpdb;
22
-        $updated = $wpdb->update(
23
-            $this->_old_table,
24
-            array('QSO_order' => $old_row['QSO_ID']),
25
-            array('QSO_ID' => $old_row['QSO_ID']),
26
-            array('%d',// QSO_order
27
-                    ),
28
-            array('%d',// QSO_ID
29
-                    )
30
-        );
31
-        if (false === $updated) {
32
-            $this->add_error(
33
-                sprintf(
34
-                    esc_html__(
35
-                        "Error in updating table %s setting QSO_order = %d where QSO_ID = %d",
36
-                        'event_espresso'
37
-                    ),
38
-                    $this->_old_table,
39
-                    $old_row['QSO_ID'],
40
-                    $old_row['QSO_ID']
41
-                )
42
-            );
43
-        }
44
-    }
10
+	public function __construct()
11
+	{
12
+		global $wpdb;
13
+		$this->_pretty_name = esc_html__("Question Options", "event_espresso");
14
+		$this->_old_table = $wpdb->prefix . "esp_question_option";
15
+		parent::__construct();
16
+	}
17
+	protected function _migrate_old_row($old_row)
18
+	{
19
+		// foreach question_group_question entry with this QST_ID, we want to set its
20
+		// QSG_order equal to this question's QST_order
21
+		global $wpdb;
22
+		$updated = $wpdb->update(
23
+			$this->_old_table,
24
+			array('QSO_order' => $old_row['QSO_ID']),
25
+			array('QSO_ID' => $old_row['QSO_ID']),
26
+			array('%d',// QSO_order
27
+					),
28
+			array('%d',// QSO_ID
29
+					)
30
+		);
31
+		if (false === $updated) {
32
+			$this->add_error(
33
+				sprintf(
34
+					esc_html__(
35
+						"Error in updating table %s setting QSO_order = %d where QSO_ID = %d",
36
+						'event_espresso'
37
+					),
38
+					$this->_old_table,
39
+					$old_row['QSO_ID'],
40
+					$old_row['QSO_ID']
41
+				)
42
+			);
43
+		}
44
+	}
45 45
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         global $wpdb;
13 13
         $this->_pretty_name = esc_html__("Question Options", "event_espresso");
14
-        $this->_old_table = $wpdb->prefix . "esp_question_option";
14
+        $this->_old_table = $wpdb->prefix."esp_question_option";
15 15
         parent::__construct();
16 16
     }
17 17
     protected function _migrate_old_row($old_row)
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
             $this->_old_table,
24 24
             array('QSO_order' => $old_row['QSO_ID']),
25 25
             array('QSO_ID' => $old_row['QSO_ID']),
26
-            array('%d',// QSO_order
26
+            array('%d', // QSO_order
27 27
                     ),
28
-            array('%d',// QSO_ID
28
+            array('%d', // QSO_ID
29 29
                     )
30 30
         );
31 31
         if (false === $updated) {
Please login to merge, or discard this patch.
4_8_0_stages/EE_DMS_4_8_0_event_subtotals.dmsstage.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -11,77 +11,77 @@
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    public function __construct()
15
-    {
16
-        global $wpdb;
17
-        $this->_old_table = $wpdb->prefix . 'esp_line_item';
18
-        $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"';
19
-        $this->_pretty_name = esc_html__('Event Sub-total line items', 'event_espresso');
20
-        parent::__construct();
21
-    }
22
-    protected function _migrate_old_row($line_item_row)
23
-    {
24
-        global $wpdb;
25
-        // what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID
26
-        $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID']));
27
-        $new_line_item_data = array(
28
-                    'LIN_code' => 'event-' . $event_id,
29
-                    'TXN_ID' => $line_item_row['TXN_ID'],
30
-                    'LIN_name' => esc_html__('Event', 'event_espresso'),
31
-                    'LIN_desc' => $line_item_row['LIN_desc'],
32
-                    'LIN_unit_price' => $line_item_row['LIN_unit_price'],
33
-                    'LIN_percent' => $line_item_row['LIN_percent'],
34
-                    'LIN_is_taxable' => $line_item_row['LIN_is_taxable'],
35
-                    'LIN_order' => $line_item_row['LIN_order'],
36
-                    'LIN_total' => $line_item_row['LIN_total'],
37
-                    'LIN_quantity' => $line_item_row['LIN_quantity'],
38
-                    'LIN_parent' => $line_item_row['LIN_ID'],
39
-                    'LIN_type' => 'sub-total',
40
-                    'OBJ_type' => 'Event',
41
-                    'OBJ_ID' => $event_id,
42
-                );
43
-        $new_line_item_datatypes = array(
44
-                    '%s',// LIN_code
45
-                    '%d',// TXN_ID
46
-                    '%s',// LIN_name
47
-                    '%s',// LIN_desc
48
-                    '%f',// LIN_unit_price
49
-                    '%f',// LIN_percent
50
-                    '%d',// LIN_is_taxable
51
-                    '%d',// LIN_order
52
-                    '%f',// LIN_total
53
-                    '%d',// LIN_quantity
54
-                    '%d',// LIN_parent
55
-                    '%s',// LIN_type
56
-                    '%s',// OBJ_type
57
-                    '%d',// OBJ_ID
58
-                );
59
-        // insert the new event subtotal line item, pointing to this line item
60
-        $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes);
61
-        if (! $success) {
62
-            $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes));
63
-        }
64
-        $new_line_item_id = $wpdb->insert_id;
65
-        $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id);
66
-        $query = $wpdb->prepare(
67
-            "UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100",
68
-            $new_line_item_id,
69
-            $line_item_row['LIN_ID'],
70
-            $new_line_item_id
71
-        );
72
-        $success = $wpdb->query($query);
73
-        if ($success === false) {
74
-            $this->add_error(
75
-                sprintf(
76
-                    esc_html__('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'),
77
-                    $new_line_item_id,
78
-                    $line_item_row['LIN_ID'],
79
-                    $wpdb->last_error,
80
-                    $query,
81
-                    $success
82
-                )
83
-            );
84
-        }
85
-        return 1;
86
-    }
14
+	public function __construct()
15
+	{
16
+		global $wpdb;
17
+		$this->_old_table = $wpdb->prefix . 'esp_line_item';
18
+		$this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"';
19
+		$this->_pretty_name = esc_html__('Event Sub-total line items', 'event_espresso');
20
+		parent::__construct();
21
+	}
22
+	protected function _migrate_old_row($line_item_row)
23
+	{
24
+		global $wpdb;
25
+		// what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID
26
+		$event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID']));
27
+		$new_line_item_data = array(
28
+					'LIN_code' => 'event-' . $event_id,
29
+					'TXN_ID' => $line_item_row['TXN_ID'],
30
+					'LIN_name' => esc_html__('Event', 'event_espresso'),
31
+					'LIN_desc' => $line_item_row['LIN_desc'],
32
+					'LIN_unit_price' => $line_item_row['LIN_unit_price'],
33
+					'LIN_percent' => $line_item_row['LIN_percent'],
34
+					'LIN_is_taxable' => $line_item_row['LIN_is_taxable'],
35
+					'LIN_order' => $line_item_row['LIN_order'],
36
+					'LIN_total' => $line_item_row['LIN_total'],
37
+					'LIN_quantity' => $line_item_row['LIN_quantity'],
38
+					'LIN_parent' => $line_item_row['LIN_ID'],
39
+					'LIN_type' => 'sub-total',
40
+					'OBJ_type' => 'Event',
41
+					'OBJ_ID' => $event_id,
42
+				);
43
+		$new_line_item_datatypes = array(
44
+					'%s',// LIN_code
45
+					'%d',// TXN_ID
46
+					'%s',// LIN_name
47
+					'%s',// LIN_desc
48
+					'%f',// LIN_unit_price
49
+					'%f',// LIN_percent
50
+					'%d',// LIN_is_taxable
51
+					'%d',// LIN_order
52
+					'%f',// LIN_total
53
+					'%d',// LIN_quantity
54
+					'%d',// LIN_parent
55
+					'%s',// LIN_type
56
+					'%s',// OBJ_type
57
+					'%d',// OBJ_ID
58
+				);
59
+		// insert the new event subtotal line item, pointing to this line item
60
+		$success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes);
61
+		if (! $success) {
62
+			$this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes));
63
+		}
64
+		$new_line_item_id = $wpdb->insert_id;
65
+		$this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id);
66
+		$query = $wpdb->prepare(
67
+			"UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100",
68
+			$new_line_item_id,
69
+			$line_item_row['LIN_ID'],
70
+			$new_line_item_id
71
+		);
72
+		$success = $wpdb->query($query);
73
+		if ($success === false) {
74
+			$this->add_error(
75
+				sprintf(
76
+					esc_html__('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'),
77
+					$new_line_item_id,
78
+					$line_item_row['LIN_ID'],
79
+					$wpdb->last_error,
80
+					$query,
81
+					$success
82
+				)
83
+			);
84
+		}
85
+		return 1;
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function __construct()
15 15
     {
16 16
         global $wpdb;
17
-        $this->_old_table = $wpdb->prefix . 'esp_line_item';
17
+        $this->_old_table = $wpdb->prefix.'esp_line_item';
18 18
         $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"';
19 19
         $this->_pretty_name = esc_html__('Event Sub-total line items', 'event_espresso');
20 20
         parent::__construct();
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
     {
24 24
         global $wpdb;
25 25
         // what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID
26
-        $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID']));
26
+        $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM '.$wpdb->prefix.'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID']));
27 27
         $new_line_item_data = array(
28
-                    'LIN_code' => 'event-' . $event_id,
28
+                    'LIN_code' => 'event-'.$event_id,
29 29
                     'TXN_ID' => $line_item_row['TXN_ID'],
30 30
                     'LIN_name' => esc_html__('Event', 'event_espresso'),
31 31
                     'LIN_desc' => $line_item_row['LIN_desc'],
@@ -41,24 +41,24 @@  discard block
 block discarded – undo
41 41
                     'OBJ_ID' => $event_id,
42 42
                 );
43 43
         $new_line_item_datatypes = array(
44
-                    '%s',// LIN_code
45
-                    '%d',// TXN_ID
46
-                    '%s',// LIN_name
47
-                    '%s',// LIN_desc
48
-                    '%f',// LIN_unit_price
49
-                    '%f',// LIN_percent
50
-                    '%d',// LIN_is_taxable
51
-                    '%d',// LIN_order
52
-                    '%f',// LIN_total
53
-                    '%d',// LIN_quantity
54
-                    '%d',// LIN_parent
55
-                    '%s',// LIN_type
56
-                    '%s',// OBJ_type
57
-                    '%d',// OBJ_ID
44
+                    '%s', // LIN_code
45
+                    '%d', // TXN_ID
46
+                    '%s', // LIN_name
47
+                    '%s', // LIN_desc
48
+                    '%f', // LIN_unit_price
49
+                    '%f', // LIN_percent
50
+                    '%d', // LIN_is_taxable
51
+                    '%d', // LIN_order
52
+                    '%f', // LIN_total
53
+                    '%d', // LIN_quantity
54
+                    '%d', // LIN_parent
55
+                    '%s', // LIN_type
56
+                    '%s', // OBJ_type
57
+                    '%d', // OBJ_ID
58 58
                 );
59 59
         // insert the new event subtotal line item, pointing to this line item
60 60
         $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes);
61
-        if (! $success) {
61
+        if ( ! $success) {
62 62
             $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes));
63 63
         }
64 64
         $new_line_item_id = $wpdb->insert_id;
Please login to merge, or discard this patch.
data_migration_scripts/4_8_0_stages/EE_DMS_4_8_0_pretax_totals.dmsstage.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,53 +13,53 @@
 block discarded – undo
13 13
 class EE_DMS_4_8_0_pretax_totals extends EE_Data_Migration_Script_Stage
14 14
 {
15 15
 
16
-    protected $_line_item_table_name;
16
+	protected $_line_item_table_name;
17 17
 
18 18
 
19
-    /**
20
-     * Just initializes the status of the migration
21
-     */
22
-    public function __construct()
23
-    {
24
-        global $wpdb;
25
-        $this->_line_item_table_name = $wpdb->prefix . "esp_line_item";
26
-        $this->_pretty_name = esc_html__('Pre-tax total line items', 'event_espresso');
27
-        parent::__construct();
28
-    }
19
+	/**
20
+	 * Just initializes the status of the migration
21
+	 */
22
+	public function __construct()
23
+	{
24
+		global $wpdb;
25
+		$this->_line_item_table_name = $wpdb->prefix . "esp_line_item";
26
+		$this->_pretty_name = esc_html__('Pre-tax total line items', 'event_espresso');
27
+		parent::__construct();
28
+	}
29 29
 
30 30
 
31 31
 
32
-    /**
33
-     * Counts the records to migrate; the public version may cache it
34
-     * @return int
35
-     */
36
-    protected function _count_records_to_migrate()
37
-    {
38
-        return 1;
39
-    }
32
+	/**
33
+	 * Counts the records to migrate; the public version may cache it
34
+	 * @return int
35
+	 */
36
+	protected function _count_records_to_migrate()
37
+	{
38
+		return 1;
39
+	}
40 40
 
41 41
 
42 42
 
43
-    /**
44
-     * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly.
45
-     * Note: it should not alter the count of items migrated. That is done in the public function that calls this.
46
-     * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it
47
-     * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50,
48
-     * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated)
49
-     * @param int $num_items_to_migrate
50
-     * @return int number of items ACTUALLY migrated
51
-     */
52
-    protected function _migration_step($num_items_to_migrate = 50)
53
-    {
54
-        global $wpdb;
55
-        $rows_updated = $wpdb->update(
56
-            $this->_line_item_table_name,
57
-            array( 'LIN_code' => 'pre-tax-subtotal' ),
58
-            array( 'LIN_code' => 'tickets' ),
59
-            array( '%s' ),
60
-            array( '%s' )
61
-        );
62
-        $this->set_completed();
63
-        return 1;
64
-    }
43
+	/**
44
+	 * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property accordingly.
45
+	 * Note: it should not alter the count of items migrated. That is done in the public function that calls this.
46
+	 * IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the last migration step, otherwise it
47
+	 * should always return $num_items_to_migrate. (Eg, if we're migrating attendees rows from the database, and $num_items_to_migrate is set to 50,
48
+	 * then we SHOULD actually migrate 50 rows,but at very least we MUST report/return 50 items migrated)
49
+	 * @param int $num_items_to_migrate
50
+	 * @return int number of items ACTUALLY migrated
51
+	 */
52
+	protected function _migration_step($num_items_to_migrate = 50)
53
+	{
54
+		global $wpdb;
55
+		$rows_updated = $wpdb->update(
56
+			$this->_line_item_table_name,
57
+			array( 'LIN_code' => 'pre-tax-subtotal' ),
58
+			array( 'LIN_code' => 'tickets' ),
59
+			array( '%s' ),
60
+			array( '%s' )
61
+		);
62
+		$this->set_completed();
63
+		return 1;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function __construct()
23 23
     {
24 24
         global $wpdb;
25
-        $this->_line_item_table_name = $wpdb->prefix . "esp_line_item";
25
+        $this->_line_item_table_name = $wpdb->prefix."esp_line_item";
26 26
         $this->_pretty_name = esc_html__('Pre-tax total line items', 'event_espresso');
27 27
         parent::__construct();
28 28
     }
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
         global $wpdb;
55 55
         $rows_updated = $wpdb->update(
56 56
             $this->_line_item_table_name,
57
-            array( 'LIN_code' => 'pre-tax-subtotal' ),
58
-            array( 'LIN_code' => 'tickets' ),
59
-            array( '%s' ),
60
-            array( '%s' )
57
+            array('LIN_code' => 'pre-tax-subtotal'),
58
+            array('LIN_code' => 'tickets'),
59
+            array('%s'),
60
+            array('%s')
61 61
         );
62 62
         $this->set_completed();
63 63
         return 1;
Please login to merge, or discard this patch.