Completed
Branch TASK/11436/upgrade-jquery-vali... (a88457)
by
unknown
113:59 queued 101:11
created
core/services/assets/Registry.php 1 patch
Indentation   +449 added lines, -449 removed lines patch added patch discarded remove patch
@@ -24,459 +24,459 @@
 block discarded – undo
24 24
 class Registry
25 25
 {
26 26
 
27
-    /**
28
-     * @var EE_Template_Config $template_config
29
-     */
30
-    protected $template_config;
31
-
32
-    /**
33
-     * @var EE_Currency_Config $currency_config
34
-     */
35
-    protected $currency_config;
36
-
37
-    /**
38
-     * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
39
-     *
40
-     * @var array
41
-     */
42
-    protected $jsdata = array();
43
-
44
-
45
-    /**
46
-     * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
47
-     * page source.
48
-     * @var array
49
-     */
50
-    protected $script_handles_with_data = array();
51
-
52
-
53
-    /**
54
-     * @var DomainInterface
55
-     */
56
-    protected $domain;
57
-
58
-
59
-    /**
60
-     * Registry constructor.
61
-     * Hooking into WP actions for script registry.
62
-     *
63
-     * @param EE_Template_Config $template_config
64
-     * @param EE_Currency_Config $currency_config
65
-     * @param DomainInterface    $domain
66
-     */
67
-    public function __construct(
68
-        EE_Template_Config $template_config,
69
-        EE_Currency_Config $currency_config,
70
-        DomainInterface $domain
71
-    ) {
72
-        $this->template_config = $template_config;
73
-        $this->currency_config = $currency_config;
74
-        $this->domain = $domain;
75
-        add_action('wp_enqueue_scripts', array($this, 'scripts'), 1);
76
-        add_action('admin_enqueue_scripts', array($this, 'scripts'), 1);
77
-        add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 2);
78
-        add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 2);
79
-        add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
80
-        add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     * Callback for the WP script actions.
87
-     * Used to register globally accessible core scripts.
88
-     * Also used to add the eejs.data object to the source for any js having eejs-core as a dependency.
89
-     */
90
-    public function scripts()
91
-    {
92
-        global $wp_version;
93
-        wp_register_script(
94
-            'eejs-core',
95
-            EE_PLUGIN_DIR_URL . 'core/services/assets/core_assets/eejs-core.js',
96
-            array(),
97
-            EVENT_ESPRESSO_VERSION,
98
-            true
99
-        );
100
-        //only run this if WordPress 4.4.0 > is in use.
101
-        if (version_compare($wp_version, '4.4.0', '>')) {
102
-            //js.api
103
-            wp_register_script(
104
-                'eejs-api',
105
-                EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
106
-                array('underscore', 'eejs-core'),
107
-                EVENT_ESPRESSO_VERSION,
108
-                true
109
-            );
110
-            $this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest');
111
-            $this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/'));
112
-        }
113
-        if (! is_admin()) {
114
-            $this->loadCoreCss();
115
-        }
116
-        $this->loadCoreJs();
117
-        $this->loadJqueryValidate();
118
-        $this->loadAccountingJs();
119
-        $this->loadQtipJs();
120
-    }
121
-
122
-
123
-
124
-    /**
125
-     * Call back for the script print in frontend and backend.
126
-     * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
127
-     *
128
-     * @since 4.9.31.rc.015
129
-     */
130
-    public function enqueueData()
131
-    {
132
-        $this->removeAlreadyRegisteredDataForScriptHandles();
133
-        wp_localize_script('eejs-core', 'eejs', array('data' => $this->jsdata));
134
-        wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
135
-        $this->localizeAccountingJs();
136
-        $this->addRegisteredScriptHandlesWithData('eejs-core');
137
-        $this->addRegisteredScriptHandlesWithData('espresso_core');
138
-    }
139
-
140
-
141
-
142
-    /**
143
-     * Used to add data to eejs.data object.
144
-     * Note:  Overriding existing data is not allowed.
145
-     * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
146
-     * If the data you add is something like this:
147
-     *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
148
-     * It will be exposed in the page source as:
149
-     *  eejs.data.my_plugin_data.foo == gar
150
-     *
151
-     * @param string       $key   Key used to access your data
152
-     * @param string|array $value Value to attach to key
153
-     * @throws InvalidArgumentException
154
-     */
155
-    public function addData($key, $value)
156
-    {
157
-        if ($this->verifyDataNotExisting($key)) {
158
-            $this->jsdata[$key] = $value;
159
-        }
160
-    }
161
-
162
-
163
-
164
-    /**
165
-     * Similar to addData except this allows for users to push values to an existing key where the values on key are
166
-     * elements in an array.
167
-     * When you use this method, the value you include will be appended to the end of an array on $key.
168
-     * So if the $key was 'test' and you added a value of 'my_data' then it would be represented in the javascript
169
-     * object like this, eejs.data.test = [ my_data,
170
-     * ]
171
-     * If there has already been a scalar value attached to the data object given key, then
172
-     * this will throw an exception.
173
-     *
174
-     * @param string       $key   Key to attach data to.
175
-     * @param string|array $value Value being registered.
176
-     * @throws InvalidArgumentException
177
-     */
178
-    public function pushData($key, $value)
179
-    {
180
-        if (isset($this->jsdata[$key])
181
-            && ! is_array($this->jsdata[$key])
182
-        ) {
183
-            throw new invalidArgumentException(
184
-                sprintf(
185
-                    __(
186
-                        'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
27
+	/**
28
+	 * @var EE_Template_Config $template_config
29
+	 */
30
+	protected $template_config;
31
+
32
+	/**
33
+	 * @var EE_Currency_Config $currency_config
34
+	 */
35
+	protected $currency_config;
36
+
37
+	/**
38
+	 * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
39
+	 *
40
+	 * @var array
41
+	 */
42
+	protected $jsdata = array();
43
+
44
+
45
+	/**
46
+	 * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
47
+	 * page source.
48
+	 * @var array
49
+	 */
50
+	protected $script_handles_with_data = array();
51
+
52
+
53
+	/**
54
+	 * @var DomainInterface
55
+	 */
56
+	protected $domain;
57
+
58
+
59
+	/**
60
+	 * Registry constructor.
61
+	 * Hooking into WP actions for script registry.
62
+	 *
63
+	 * @param EE_Template_Config $template_config
64
+	 * @param EE_Currency_Config $currency_config
65
+	 * @param DomainInterface    $domain
66
+	 */
67
+	public function __construct(
68
+		EE_Template_Config $template_config,
69
+		EE_Currency_Config $currency_config,
70
+		DomainInterface $domain
71
+	) {
72
+		$this->template_config = $template_config;
73
+		$this->currency_config = $currency_config;
74
+		$this->domain = $domain;
75
+		add_action('wp_enqueue_scripts', array($this, 'scripts'), 1);
76
+		add_action('admin_enqueue_scripts', array($this, 'scripts'), 1);
77
+		add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 2);
78
+		add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 2);
79
+		add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
80
+		add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 * Callback for the WP script actions.
87
+	 * Used to register globally accessible core scripts.
88
+	 * Also used to add the eejs.data object to the source for any js having eejs-core as a dependency.
89
+	 */
90
+	public function scripts()
91
+	{
92
+		global $wp_version;
93
+		wp_register_script(
94
+			'eejs-core',
95
+			EE_PLUGIN_DIR_URL . 'core/services/assets/core_assets/eejs-core.js',
96
+			array(),
97
+			EVENT_ESPRESSO_VERSION,
98
+			true
99
+		);
100
+		//only run this if WordPress 4.4.0 > is in use.
101
+		if (version_compare($wp_version, '4.4.0', '>')) {
102
+			//js.api
103
+			wp_register_script(
104
+				'eejs-api',
105
+				EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
106
+				array('underscore', 'eejs-core'),
107
+				EVENT_ESPRESSO_VERSION,
108
+				true
109
+			);
110
+			$this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest');
111
+			$this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/'));
112
+		}
113
+		if (! is_admin()) {
114
+			$this->loadCoreCss();
115
+		}
116
+		$this->loadCoreJs();
117
+		$this->loadJqueryValidate();
118
+		$this->loadAccountingJs();
119
+		$this->loadQtipJs();
120
+	}
121
+
122
+
123
+
124
+	/**
125
+	 * Call back for the script print in frontend and backend.
126
+	 * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
127
+	 *
128
+	 * @since 4.9.31.rc.015
129
+	 */
130
+	public function enqueueData()
131
+	{
132
+		$this->removeAlreadyRegisteredDataForScriptHandles();
133
+		wp_localize_script('eejs-core', 'eejs', array('data' => $this->jsdata));
134
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
135
+		$this->localizeAccountingJs();
136
+		$this->addRegisteredScriptHandlesWithData('eejs-core');
137
+		$this->addRegisteredScriptHandlesWithData('espresso_core');
138
+	}
139
+
140
+
141
+
142
+	/**
143
+	 * Used to add data to eejs.data object.
144
+	 * Note:  Overriding existing data is not allowed.
145
+	 * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
146
+	 * If the data you add is something like this:
147
+	 *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
148
+	 * It will be exposed in the page source as:
149
+	 *  eejs.data.my_plugin_data.foo == gar
150
+	 *
151
+	 * @param string       $key   Key used to access your data
152
+	 * @param string|array $value Value to attach to key
153
+	 * @throws InvalidArgumentException
154
+	 */
155
+	public function addData($key, $value)
156
+	{
157
+		if ($this->verifyDataNotExisting($key)) {
158
+			$this->jsdata[$key] = $value;
159
+		}
160
+	}
161
+
162
+
163
+
164
+	/**
165
+	 * Similar to addData except this allows for users to push values to an existing key where the values on key are
166
+	 * elements in an array.
167
+	 * When you use this method, the value you include will be appended to the end of an array on $key.
168
+	 * So if the $key was 'test' and you added a value of 'my_data' then it would be represented in the javascript
169
+	 * object like this, eejs.data.test = [ my_data,
170
+	 * ]
171
+	 * If there has already been a scalar value attached to the data object given key, then
172
+	 * this will throw an exception.
173
+	 *
174
+	 * @param string       $key   Key to attach data to.
175
+	 * @param string|array $value Value being registered.
176
+	 * @throws InvalidArgumentException
177
+	 */
178
+	public function pushData($key, $value)
179
+	{
180
+		if (isset($this->jsdata[$key])
181
+			&& ! is_array($this->jsdata[$key])
182
+		) {
183
+			throw new invalidArgumentException(
184
+				sprintf(
185
+					__(
186
+						'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
187 187
                          push values to this data element when it is an array.',
188
-                        'event_espresso'
189
-                    ),
190
-                    $key,
191
-                    __METHOD__
192
-                )
193
-            );
194
-        }
195
-        $this->jsdata[$key][] = $value;
196
-    }
197
-
198
-
199
-
200
-    /**
201
-     * Used to set content used by javascript for a template.
202
-     * Note: Overrides of existing registered templates are not allowed.
203
-     *
204
-     * @param string $template_reference
205
-     * @param string $template_content
206
-     * @throws InvalidArgumentException
207
-     */
208
-    public function addTemplate($template_reference, $template_content)
209
-    {
210
-        if (! isset($this->jsdata['templates'])) {
211
-            $this->jsdata['templates'] = array();
212
-        }
213
-        //no overrides allowed.
214
-        if (isset($this->jsdata['templates'][$template_reference])) {
215
-            throw new invalidArgumentException(
216
-                sprintf(
217
-                    __(
218
-                        'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
219
-                        'event_espresso'
220
-                    ),
221
-                    $template_reference
222
-                )
223
-            );
224
-        }
225
-        $this->jsdata['templates'][$template_reference] = $template_content;
226
-    }
227
-
228
-
229
-
230
-    /**
231
-     * Retrieve the template content already registered for the given reference.
232
-     *
233
-     * @param string $template_reference
234
-     * @return string
235
-     */
236
-    public function getTemplate($template_reference)
237
-    {
238
-        return isset($this->jsdata['templates'], $this->jsdata['templates'][$template_reference])
239
-            ? $this->jsdata['templates'][$template_reference]
240
-            : '';
241
-    }
242
-
243
-
244
-
245
-    /**
246
-     * Retrieve registered data.
247
-     *
248
-     * @param string $key Name of key to attach data to.
249
-     * @return mixed                If there is no for the given key, then false is returned.
250
-     */
251
-    public function getData($key)
252
-    {
253
-        return isset($this->jsdata[$key])
254
-            ? $this->jsdata[$key]
255
-            : false;
256
-    }
257
-
258
-
259
-
260
-    /**
261
-     * Verifies whether the given data exists already on the jsdata array.
262
-     * Overriding data is not allowed.
263
-     *
264
-     * @param string $key Index for data.
265
-     * @return bool        If valid then return true.
266
-     * @throws InvalidArgumentException if data already exists.
267
-     */
268
-    protected function verifyDataNotExisting($key)
269
-    {
270
-        if (isset($this->jsdata[$key])) {
271
-            if (is_array($this->jsdata[$key])) {
272
-                throw new InvalidArgumentException(
273
-                    sprintf(
274
-                        __(
275
-                            'The value for %1$s already exists in the Registry::eejs object.
188
+						'event_espresso'
189
+					),
190
+					$key,
191
+					__METHOD__
192
+				)
193
+			);
194
+		}
195
+		$this->jsdata[$key][] = $value;
196
+	}
197
+
198
+
199
+
200
+	/**
201
+	 * Used to set content used by javascript for a template.
202
+	 * Note: Overrides of existing registered templates are not allowed.
203
+	 *
204
+	 * @param string $template_reference
205
+	 * @param string $template_content
206
+	 * @throws InvalidArgumentException
207
+	 */
208
+	public function addTemplate($template_reference, $template_content)
209
+	{
210
+		if (! isset($this->jsdata['templates'])) {
211
+			$this->jsdata['templates'] = array();
212
+		}
213
+		//no overrides allowed.
214
+		if (isset($this->jsdata['templates'][$template_reference])) {
215
+			throw new invalidArgumentException(
216
+				sprintf(
217
+					__(
218
+						'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
219
+						'event_espresso'
220
+					),
221
+					$template_reference
222
+				)
223
+			);
224
+		}
225
+		$this->jsdata['templates'][$template_reference] = $template_content;
226
+	}
227
+
228
+
229
+
230
+	/**
231
+	 * Retrieve the template content already registered for the given reference.
232
+	 *
233
+	 * @param string $template_reference
234
+	 * @return string
235
+	 */
236
+	public function getTemplate($template_reference)
237
+	{
238
+		return isset($this->jsdata['templates'], $this->jsdata['templates'][$template_reference])
239
+			? $this->jsdata['templates'][$template_reference]
240
+			: '';
241
+	}
242
+
243
+
244
+
245
+	/**
246
+	 * Retrieve registered data.
247
+	 *
248
+	 * @param string $key Name of key to attach data to.
249
+	 * @return mixed                If there is no for the given key, then false is returned.
250
+	 */
251
+	public function getData($key)
252
+	{
253
+		return isset($this->jsdata[$key])
254
+			? $this->jsdata[$key]
255
+			: false;
256
+	}
257
+
258
+
259
+
260
+	/**
261
+	 * Verifies whether the given data exists already on the jsdata array.
262
+	 * Overriding data is not allowed.
263
+	 *
264
+	 * @param string $key Index for data.
265
+	 * @return bool        If valid then return true.
266
+	 * @throws InvalidArgumentException if data already exists.
267
+	 */
268
+	protected function verifyDataNotExisting($key)
269
+	{
270
+		if (isset($this->jsdata[$key])) {
271
+			if (is_array($this->jsdata[$key])) {
272
+				throw new InvalidArgumentException(
273
+					sprintf(
274
+						__(
275
+							'The value for %1$s already exists in the Registry::eejs object.
276 276
                             Overrides are not allowed. Since the value of this data is an array, you may want to use the
277 277
                             %2$s method to push your value to the array.',
278
-                            'event_espresso'
279
-                        ),
280
-                        $key,
281
-                        'pushData()'
282
-                    )
283
-                );
284
-            }
285
-            throw new InvalidArgumentException(
286
-                sprintf(
287
-                    __(
288
-                        'The value for %1$s already exists in the Registry::eejs object. Overrides are not
278
+							'event_espresso'
279
+						),
280
+						$key,
281
+						'pushData()'
282
+					)
283
+				);
284
+			}
285
+			throw new InvalidArgumentException(
286
+				sprintf(
287
+					__(
288
+						'The value for %1$s already exists in the Registry::eejs object. Overrides are not
289 289
                         allowed.  Consider attaching your value to a different key',
290
-                        'event_espresso'
291
-                    ),
292
-                    $key
293
-                )
294
-            );
295
-        }
296
-        return true;
297
-    }
298
-
299
-
300
-
301
-    /**
302
-     * registers core default stylesheets
303
-     */
304
-    private function loadCoreCss()
305
-    {
306
-        if ($this->template_config->enable_default_style) {
307
-            $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
308
-                ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
309
-                : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';
310
-            wp_register_style(
311
-                'espresso_default',
312
-                $default_stylesheet_path,
313
-                array('dashicons'),
314
-                EVENT_ESPRESSO_VERSION
315
-            );
316
-            //Load custom style sheet if available
317
-            if ($this->template_config->custom_style_sheet !== null) {
318
-                wp_register_style(
319
-                    'espresso_custom_css',
320
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
321
-                    array('espresso_default'),
322
-                    EVENT_ESPRESSO_VERSION
323
-                );
324
-            }
325
-        }
326
-    }
327
-
328
-
329
-
330
-    /**
331
-     * registers core default javascript
332
-     */
333
-    private function loadCoreJs()
334
-    {
335
-        // load core js
336
-        wp_register_script(
337
-            'espresso_core',
338
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
339
-            array('jquery'),
340
-            EVENT_ESPRESSO_VERSION,
341
-            true
342
-        );
343
-    }
344
-
345
-
346
-
347
-    /**
348
-     * registers jQuery Validate for form validation
349
-     */
350
-    private function loadJqueryValidate()
351
-    {
352
-        // register jQuery Validate and additional methods
353
-        wp_register_script(
354
-            'jquery-validate',
355
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
356
-            array('jquery'),
357
-            '1.15.0',
358
-            true
359
-        );
360
-        wp_register_script(
361
-            'jquery-validate-extra-methods',
362
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
363
-            array('jquery', 'jquery-validate'),
364
-            '1.15.0',
365
-            true
366
-        );
367
-    }
368
-
369
-
370
-
371
-    /**
372
-     * registers accounting.js for performing client-side calculations
373
-     */
374
-    private function loadAccountingJs()
375
-    {
376
-        //accounting.js library
377
-        // @link http://josscrowcroft.github.io/accounting.js/
378
-        wp_register_script(
379
-            'ee-accounting-core',
380
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
381
-            array('underscore'),
382
-            '0.3.2',
383
-            true
384
-        );
385
-        wp_register_script(
386
-            'ee-accounting',
387
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
388
-            array('ee-accounting-core'),
389
-            EVENT_ESPRESSO_VERSION,
390
-            true
391
-        );
392
-    }
393
-
394
-
395
-
396
-    /**
397
-     * registers accounting.js for performing client-side calculations
398
-     */
399
-    private function localizeAccountingJs()
400
-    {
401
-        wp_localize_script(
402
-            'ee-accounting',
403
-            'EE_ACCOUNTING_CFG',
404
-            array(
405
-                'currency' => array(
406
-                    'symbol'    => $this->currency_config->sign,
407
-                    'format'    => array(
408
-                        'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
409
-                        'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
410
-                        'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
411
-                    ),
412
-                    'decimal'   => $this->currency_config->dec_mrk,
413
-                    'thousand'  => $this->currency_config->thsnds,
414
-                    'precision' => $this->currency_config->dec_plc,
415
-                ),
416
-                'number'   => array(
417
-                    'precision' => $this->currency_config->dec_plc,
418
-                    'thousand'  => $this->currency_config->thsnds,
419
-                    'decimal'   => $this->currency_config->dec_mrk,
420
-                ),
421
-            )
422
-        );
423
-        $this->addRegisteredScriptHandlesWithData('ee-accounting');
424
-    }
425
-
426
-
427
-
428
-    /**
429
-     * registers assets for cleaning your ears
430
-     */
431
-    private function loadQtipJs()
432
-    {
433
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
434
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
435
-        if (apply_filters('FHEE_load_qtip', false)) {
436
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
437
-        }
438
-    }
439
-
440
-
441
-    /**
442
-     * This is used to set registered script handles that have data.
443
-     * @param string $script_handle
444
-     */
445
-    private function addRegisteredScriptHandlesWithData($script_handle)
446
-    {
447
-        $this->script_handles_with_data[$script_handle] = $script_handle;
448
-    }
449
-
450
-
451
-    /**
452
-     * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
453
-     * Dependency stored in WP_Scripts if its set.
454
-     */
455
-    private function removeAlreadyRegisteredDataForScriptHandles()
456
-    {
457
-        if (empty($this->script_handles_with_data)) {
458
-            return;
459
-        }
460
-        foreach ($this->script_handles_with_data as $script_handle) {
461
-            $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
462
-        }
463
-    }
464
-
465
-
466
-    /**
467
-     * Removes any data dependency registered in WP_Scripts if its set.
468
-     * @param string $script_handle
469
-     */
470
-    private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
471
-    {
472
-        if (isset($this->script_handles_with_data[$script_handle])) {
473
-            global $wp_scripts;
474
-            if ($wp_scripts->get_data($script_handle, 'data')) {
475
-                unset($wp_scripts->registered[$script_handle]->extra['data']);
476
-                unset($this->script_handles_with_data[$script_handle]);
477
-            }
478
-        }
479
-    }
290
+						'event_espresso'
291
+					),
292
+					$key
293
+				)
294
+			);
295
+		}
296
+		return true;
297
+	}
298
+
299
+
300
+
301
+	/**
302
+	 * registers core default stylesheets
303
+	 */
304
+	private function loadCoreCss()
305
+	{
306
+		if ($this->template_config->enable_default_style) {
307
+			$default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
308
+				? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
309
+				: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';
310
+			wp_register_style(
311
+				'espresso_default',
312
+				$default_stylesheet_path,
313
+				array('dashicons'),
314
+				EVENT_ESPRESSO_VERSION
315
+			);
316
+			//Load custom style sheet if available
317
+			if ($this->template_config->custom_style_sheet !== null) {
318
+				wp_register_style(
319
+					'espresso_custom_css',
320
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
321
+					array('espresso_default'),
322
+					EVENT_ESPRESSO_VERSION
323
+				);
324
+			}
325
+		}
326
+	}
327
+
328
+
329
+
330
+	/**
331
+	 * registers core default javascript
332
+	 */
333
+	private function loadCoreJs()
334
+	{
335
+		// load core js
336
+		wp_register_script(
337
+			'espresso_core',
338
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
339
+			array('jquery'),
340
+			EVENT_ESPRESSO_VERSION,
341
+			true
342
+		);
343
+	}
344
+
345
+
346
+
347
+	/**
348
+	 * registers jQuery Validate for form validation
349
+	 */
350
+	private function loadJqueryValidate()
351
+	{
352
+		// register jQuery Validate and additional methods
353
+		wp_register_script(
354
+			'jquery-validate',
355
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
356
+			array('jquery'),
357
+			'1.15.0',
358
+			true
359
+		);
360
+		wp_register_script(
361
+			'jquery-validate-extra-methods',
362
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
363
+			array('jquery', 'jquery-validate'),
364
+			'1.15.0',
365
+			true
366
+		);
367
+	}
368
+
369
+
370
+
371
+	/**
372
+	 * registers accounting.js for performing client-side calculations
373
+	 */
374
+	private function loadAccountingJs()
375
+	{
376
+		//accounting.js library
377
+		// @link http://josscrowcroft.github.io/accounting.js/
378
+		wp_register_script(
379
+			'ee-accounting-core',
380
+			EE_THIRD_PARTY_URL . 'accounting/accounting.js',
381
+			array('underscore'),
382
+			'0.3.2',
383
+			true
384
+		);
385
+		wp_register_script(
386
+			'ee-accounting',
387
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
388
+			array('ee-accounting-core'),
389
+			EVENT_ESPRESSO_VERSION,
390
+			true
391
+		);
392
+	}
393
+
394
+
395
+
396
+	/**
397
+	 * registers accounting.js for performing client-side calculations
398
+	 */
399
+	private function localizeAccountingJs()
400
+	{
401
+		wp_localize_script(
402
+			'ee-accounting',
403
+			'EE_ACCOUNTING_CFG',
404
+			array(
405
+				'currency' => array(
406
+					'symbol'    => $this->currency_config->sign,
407
+					'format'    => array(
408
+						'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
409
+						'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
410
+						'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
411
+					),
412
+					'decimal'   => $this->currency_config->dec_mrk,
413
+					'thousand'  => $this->currency_config->thsnds,
414
+					'precision' => $this->currency_config->dec_plc,
415
+				),
416
+				'number'   => array(
417
+					'precision' => $this->currency_config->dec_plc,
418
+					'thousand'  => $this->currency_config->thsnds,
419
+					'decimal'   => $this->currency_config->dec_mrk,
420
+				),
421
+			)
422
+		);
423
+		$this->addRegisteredScriptHandlesWithData('ee-accounting');
424
+	}
425
+
426
+
427
+
428
+	/**
429
+	 * registers assets for cleaning your ears
430
+	 */
431
+	private function loadQtipJs()
432
+	{
433
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
434
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
435
+		if (apply_filters('FHEE_load_qtip', false)) {
436
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
437
+		}
438
+	}
439
+
440
+
441
+	/**
442
+	 * This is used to set registered script handles that have data.
443
+	 * @param string $script_handle
444
+	 */
445
+	private function addRegisteredScriptHandlesWithData($script_handle)
446
+	{
447
+		$this->script_handles_with_data[$script_handle] = $script_handle;
448
+	}
449
+
450
+
451
+	/**
452
+	 * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
453
+	 * Dependency stored in WP_Scripts if its set.
454
+	 */
455
+	private function removeAlreadyRegisteredDataForScriptHandles()
456
+	{
457
+		if (empty($this->script_handles_with_data)) {
458
+			return;
459
+		}
460
+		foreach ($this->script_handles_with_data as $script_handle) {
461
+			$this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
462
+		}
463
+	}
464
+
465
+
466
+	/**
467
+	 * Removes any data dependency registered in WP_Scripts if its set.
468
+	 * @param string $script_handle
469
+	 */
470
+	private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
471
+	{
472
+		if (isset($this->script_handles_with_data[$script_handle])) {
473
+			global $wp_scripts;
474
+			if ($wp_scripts->get_data($script_handle, 'data')) {
475
+				unset($wp_scripts->registered[$script_handle]->extra['data']);
476
+				unset($this->script_handles_with_data[$script_handle]);
477
+			}
478
+		}
479
+	}
480 480
 
481 481
 
482 482
 }
Please login to merge, or discard this patch.
core/services/bootstrap/BootstrapCore.php 1 patch
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -52,234 +52,234 @@
 block discarded – undo
52 52
 class BootstrapCore
53 53
 {
54 54
 
55
-    /**
56
-     * @type LoaderInterface $loader
57
-     */
58
-    private $loader;
59
-
60
-    /**
61
-     * @var RequestInterface $request
62
-     */
63
-    protected $request;
64
-
65
-    /**
66
-     * @var ResponseInterface $response
67
-     */
68
-    protected $response;
69
-
70
-    /**
71
-     * @var RequestStackBuilder $request_stack_builder
72
-     */
73
-    protected $request_stack_builder;
74
-
75
-    /**
76
-     * @var RequestStack $request_stack
77
-     */
78
-    protected $request_stack;
79
-
80
-
81
-    /**
82
-     * BootstrapCore constructor.
83
-     */
84
-    public function __construct()
85
-    {
86
-        // construct request stack and run middleware apps as soon as all WP plugins are loaded
87
-        add_action('plugins_loaded', array($this, 'initialize'), 0);
88
-    }
89
-
90
-
91
-    /**
92
-     * @throws InvalidRequestStackMiddlewareException
93
-     * @throws InvalidClassException
94
-     * @throws DomainException
95
-     * @throws EE_Error
96
-     * @throws InvalidArgumentException
97
-     * @throws InvalidDataTypeException
98
-     * @throws InvalidInterfaceException
99
-     * @throws ReflectionException
100
-     */
101
-    public function initialize()
102
-    {
103
-        $this->bootstrapDependencyInjectionContainer();
104
-        $this->bootstrapDomain();
105
-        $bootstrap_request = $this->bootstrapRequestResponseObjects();
106
-        add_action(
107
-            'EE_Load_Espresso_Core__handle_request__initialize_core_loading',
108
-            array($bootstrap_request, 'setupLegacyRequest')
109
-        );
110
-        $this->runRequestStack();
111
-    }
112
-
113
-
114
-    /**
115
-     * @throws ReflectionException
116
-     * @throws EE_Error
117
-     * @throws InvalidArgumentException
118
-     * @throws InvalidDataTypeException
119
-     * @throws InvalidInterfaceException
120
-     */
121
-    private function bootstrapDependencyInjectionContainer()
122
-    {
123
-        $bootstrap_di = new BootstrapDependencyInjectionContainer();
124
-        $bootstrap_di->buildLegacyDependencyInjectionContainer();
125
-        $bootstrap_di->buildLoader();
126
-        $registry = $bootstrap_di->getRegistry();
127
-        $dependency_map = $bootstrap_di->getDependencyMap();
128
-        $dependency_map->initialize();
129
-        $registry->initialize();
130
-        $this->loader = $bootstrap_di->getLoader();
131
-    }
132
-
133
-
134
-    /**
135
-     * configures the Domain object for core
136
-     *
137
-     * @return void
138
-     * @throws DomainException
139
-     * @throws InvalidArgumentException
140
-     * @throws InvalidDataTypeException
141
-     * @throws InvalidClassException
142
-     * @throws InvalidFilePathException
143
-     * @throws InvalidInterfaceException
144
-     */
145
-    private function bootstrapDomain()
146
-    {
147
-        DomainFactory::getShared(
148
-            new FullyQualifiedName(
149
-                'EventEspresso\core\domain\Domain'
150
-            ),
151
-            array(
152
-                new FilePath(EVENT_ESPRESSO_MAIN_FILE),
153
-                Version::fromString(espresso_version())
154
-            )
155
-        );
156
-    }
157
-
158
-
159
-    /**
160
-     * sets up the request and response objects
161
-     *
162
-     * @return BootstrapRequestResponseObjects
163
-     * @throws InvalidArgumentException
164
-     */
165
-    private function bootstrapRequestResponseObjects()
166
-    {
167
-        /** @var BootstrapRequestResponseObjects $bootstrap_request */
168
-        $bootstrap_request = $this->loader->getShared(
169
-            'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects',
170
-            array($this->loader)
171
-        );
172
-        $bootstrap_request->buildRequestResponse();
173
-        $bootstrap_request->shareRequestResponse();
174
-        $this->request  = $this->loader->getShared('EventEspresso\core\services\request\Request');
175
-        $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response');
176
-        return $bootstrap_request;
177
-    }
178
-
179
-
180
-    /**
181
-     * run_request_stack
182
-     * construct request stack and run middleware apps
183
-     *
184
-     * @throws InvalidRequestStackMiddlewareException
185
-     * @throws InvalidInterfaceException
186
-     * @throws InvalidDataTypeException
187
-     * @throws EE_Error
188
-     */
189
-    public function runRequestStack()
190
-    {
191
-        $this->loadAutoloader();
192
-        $this->setAutoloadersForRequiredFiles();
193
-        $this->request_stack_builder = $this->buildRequestStack();
194
-        $this->request_stack         = $this->request_stack_builder->resolve(
195
-            new RequestStackCoreApp()
196
-        );
197
-        $this->request_stack->handleRequest($this->request, $this->response);
198
-        $this->request_stack->handleResponse();
199
-    }
200
-
201
-
202
-    /**
203
-     * load_autoloader
204
-     *
205
-     * @throws EE_Error
206
-     */
207
-    protected function loadAutoloader()
208
-    {
209
-        // load interfaces
210
-        espresso_load_required(
211
-            'EEH_Autoloader',
212
-            EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php'
213
-        );
214
-        EEH_Autoloader::instance();
215
-    }
216
-
217
-
218
-
219
-    /**
220
-     * load_required_files
221
-     *
222
-     * @throws EE_Error
223
-     */
224
-    protected function setAutoloadersForRequiredFiles()
225
-    {
226
-        // load interfaces
227
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true);
228
-        // load helpers
229
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
230
-        // load request stack
231
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
232
-        // load middleware
233
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
234
-    }
235
-
236
-
237
-
238
-    /**
239
-     * build_request_stack
240
-     *
241
-     * @return RequestStackBuilder
242
-     */
243
-    public function buildRequestStack()
244
-    {
245
-        $request_stack_builder = new RequestStackBuilder($this->loader);
246
-        /**
247
-         * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT
248
-         * so items at the beginning of the final middleware stack will run last.
249
-         * First parameter is the middleware classname, second is an array of arguments
250
-         */
251
-        $stack_apps            = apply_filters(
252
-            'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps',
253
-            array(
254
-                // first in last out
255
-                'EventEspresso\core\services\request\middleware\BotDetector' => array(),
256
-                'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(),
257
-                'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(),
258
-                'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(),
259
-                // last in first out
260
-                'EventEspresso\core\services\request\middleware\DetectLogin' => array(),
261
-            )
262
-        );
263
-        // legacy filter for backwards compatibility
264
-        $stack_apps            = apply_filters(
265
-            'FHEE__EE_Bootstrap__build_request_stack__stack_apps',
266
-            $stack_apps
267
-        );
268
-        // load middleware onto stack : FILO (First In Last Out)
269
-        // items at the beginning of the $stack_apps array will run last
270
-        foreach ((array) $stack_apps as $stack_app => $stack_app_args) {
271
-            $request_stack_builder->push(array($stack_app, $stack_app_args));
272
-        }
273
-        // finally, we'll add this on its own because we need it to always be part of the stack
274
-        // and we also need it to always run first because the rest of the system relies on it
275
-        $request_stack_builder->push(
276
-            array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array())
277
-        );
278
-        return apply_filters(
279
-            'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder',
280
-            $request_stack_builder
281
-        );
282
-    }
55
+	/**
56
+	 * @type LoaderInterface $loader
57
+	 */
58
+	private $loader;
59
+
60
+	/**
61
+	 * @var RequestInterface $request
62
+	 */
63
+	protected $request;
64
+
65
+	/**
66
+	 * @var ResponseInterface $response
67
+	 */
68
+	protected $response;
69
+
70
+	/**
71
+	 * @var RequestStackBuilder $request_stack_builder
72
+	 */
73
+	protected $request_stack_builder;
74
+
75
+	/**
76
+	 * @var RequestStack $request_stack
77
+	 */
78
+	protected $request_stack;
79
+
80
+
81
+	/**
82
+	 * BootstrapCore constructor.
83
+	 */
84
+	public function __construct()
85
+	{
86
+		// construct request stack and run middleware apps as soon as all WP plugins are loaded
87
+		add_action('plugins_loaded', array($this, 'initialize'), 0);
88
+	}
89
+
90
+
91
+	/**
92
+	 * @throws InvalidRequestStackMiddlewareException
93
+	 * @throws InvalidClassException
94
+	 * @throws DomainException
95
+	 * @throws EE_Error
96
+	 * @throws InvalidArgumentException
97
+	 * @throws InvalidDataTypeException
98
+	 * @throws InvalidInterfaceException
99
+	 * @throws ReflectionException
100
+	 */
101
+	public function initialize()
102
+	{
103
+		$this->bootstrapDependencyInjectionContainer();
104
+		$this->bootstrapDomain();
105
+		$bootstrap_request = $this->bootstrapRequestResponseObjects();
106
+		add_action(
107
+			'EE_Load_Espresso_Core__handle_request__initialize_core_loading',
108
+			array($bootstrap_request, 'setupLegacyRequest')
109
+		);
110
+		$this->runRequestStack();
111
+	}
112
+
113
+
114
+	/**
115
+	 * @throws ReflectionException
116
+	 * @throws EE_Error
117
+	 * @throws InvalidArgumentException
118
+	 * @throws InvalidDataTypeException
119
+	 * @throws InvalidInterfaceException
120
+	 */
121
+	private function bootstrapDependencyInjectionContainer()
122
+	{
123
+		$bootstrap_di = new BootstrapDependencyInjectionContainer();
124
+		$bootstrap_di->buildLegacyDependencyInjectionContainer();
125
+		$bootstrap_di->buildLoader();
126
+		$registry = $bootstrap_di->getRegistry();
127
+		$dependency_map = $bootstrap_di->getDependencyMap();
128
+		$dependency_map->initialize();
129
+		$registry->initialize();
130
+		$this->loader = $bootstrap_di->getLoader();
131
+	}
132
+
133
+
134
+	/**
135
+	 * configures the Domain object for core
136
+	 *
137
+	 * @return void
138
+	 * @throws DomainException
139
+	 * @throws InvalidArgumentException
140
+	 * @throws InvalidDataTypeException
141
+	 * @throws InvalidClassException
142
+	 * @throws InvalidFilePathException
143
+	 * @throws InvalidInterfaceException
144
+	 */
145
+	private function bootstrapDomain()
146
+	{
147
+		DomainFactory::getShared(
148
+			new FullyQualifiedName(
149
+				'EventEspresso\core\domain\Domain'
150
+			),
151
+			array(
152
+				new FilePath(EVENT_ESPRESSO_MAIN_FILE),
153
+				Version::fromString(espresso_version())
154
+			)
155
+		);
156
+	}
157
+
158
+
159
+	/**
160
+	 * sets up the request and response objects
161
+	 *
162
+	 * @return BootstrapRequestResponseObjects
163
+	 * @throws InvalidArgumentException
164
+	 */
165
+	private function bootstrapRequestResponseObjects()
166
+	{
167
+		/** @var BootstrapRequestResponseObjects $bootstrap_request */
168
+		$bootstrap_request = $this->loader->getShared(
169
+			'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects',
170
+			array($this->loader)
171
+		);
172
+		$bootstrap_request->buildRequestResponse();
173
+		$bootstrap_request->shareRequestResponse();
174
+		$this->request  = $this->loader->getShared('EventEspresso\core\services\request\Request');
175
+		$this->response = $this->loader->getShared('EventEspresso\core\services\request\Response');
176
+		return $bootstrap_request;
177
+	}
178
+
179
+
180
+	/**
181
+	 * run_request_stack
182
+	 * construct request stack and run middleware apps
183
+	 *
184
+	 * @throws InvalidRequestStackMiddlewareException
185
+	 * @throws InvalidInterfaceException
186
+	 * @throws InvalidDataTypeException
187
+	 * @throws EE_Error
188
+	 */
189
+	public function runRequestStack()
190
+	{
191
+		$this->loadAutoloader();
192
+		$this->setAutoloadersForRequiredFiles();
193
+		$this->request_stack_builder = $this->buildRequestStack();
194
+		$this->request_stack         = $this->request_stack_builder->resolve(
195
+			new RequestStackCoreApp()
196
+		);
197
+		$this->request_stack->handleRequest($this->request, $this->response);
198
+		$this->request_stack->handleResponse();
199
+	}
200
+
201
+
202
+	/**
203
+	 * load_autoloader
204
+	 *
205
+	 * @throws EE_Error
206
+	 */
207
+	protected function loadAutoloader()
208
+	{
209
+		// load interfaces
210
+		espresso_load_required(
211
+			'EEH_Autoloader',
212
+			EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php'
213
+		);
214
+		EEH_Autoloader::instance();
215
+	}
216
+
217
+
218
+
219
+	/**
220
+	 * load_required_files
221
+	 *
222
+	 * @throws EE_Error
223
+	 */
224
+	protected function setAutoloadersForRequiredFiles()
225
+	{
226
+		// load interfaces
227
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true);
228
+		// load helpers
229
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
230
+		// load request stack
231
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
232
+		// load middleware
233
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
234
+	}
235
+
236
+
237
+
238
+	/**
239
+	 * build_request_stack
240
+	 *
241
+	 * @return RequestStackBuilder
242
+	 */
243
+	public function buildRequestStack()
244
+	{
245
+		$request_stack_builder = new RequestStackBuilder($this->loader);
246
+		/**
247
+		 * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT
248
+		 * so items at the beginning of the final middleware stack will run last.
249
+		 * First parameter is the middleware classname, second is an array of arguments
250
+		 */
251
+		$stack_apps            = apply_filters(
252
+			'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps',
253
+			array(
254
+				// first in last out
255
+				'EventEspresso\core\services\request\middleware\BotDetector' => array(),
256
+				'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(),
257
+				'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(),
258
+				'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(),
259
+				// last in first out
260
+				'EventEspresso\core\services\request\middleware\DetectLogin' => array(),
261
+			)
262
+		);
263
+		// legacy filter for backwards compatibility
264
+		$stack_apps            = apply_filters(
265
+			'FHEE__EE_Bootstrap__build_request_stack__stack_apps',
266
+			$stack_apps
267
+		);
268
+		// load middleware onto stack : FILO (First In Last Out)
269
+		// items at the beginning of the $stack_apps array will run last
270
+		foreach ((array) $stack_apps as $stack_app => $stack_app_args) {
271
+			$request_stack_builder->push(array($stack_app, $stack_app_args));
272
+		}
273
+		// finally, we'll add this on its own because we need it to always be part of the stack
274
+		// and we also need it to always run first because the rest of the system relies on it
275
+		$request_stack_builder->push(
276
+			array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array())
277
+		);
278
+		return apply_filters(
279
+			'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder',
280
+			$request_stack_builder
281
+		);
282
+	}
283 283
 
284 284
 
285 285
 }
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since       4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 
64 64
 } else {
65
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
66
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
67
-        /**
68
-         * espresso_minimum_php_version_error
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
65
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
66
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
67
+		/**
68
+		 * espresso_minimum_php_version_error
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.031');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.031');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.
message_type/newsletter/EE_Messages_Email_Newsletter_Validator.class.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since           4.3.0
8 8
  */
9 9
 if (! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 /**
@@ -21,59 +21,59 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator
23 23
 {
24
-    public function __construct($fields, $context)
25
-    {
26
-        $this->_m_name = 'email';
27
-        $this->_mt_name = 'newsletter';
24
+	public function __construct($fields, $context)
25
+	{
26
+		$this->_m_name = 'email';
27
+		$this->_mt_name = 'newsletter';
28 28
 
29
-        parent::__construct($fields, $context);
30
-    }
29
+		parent::__construct($fields, $context);
30
+	}
31 31
 
32
-    /**
33
-     * custom validator (restricting what was originally set by the messenger)
34
-     */
35
-    protected function _modify_validator()
36
-    {
37
-        if ($this->_context == 'attendee') {
38
-            $this->_valid_shortcodes_modifier[$this->_context]['from'] = array(
39
-                'recipient_details',
40
-                'email',
41
-                'organization',
42
-            );
43
-        }
32
+	/**
33
+	 * custom validator (restricting what was originally set by the messenger)
34
+	 */
35
+	protected function _modify_validator()
36
+	{
37
+		if ($this->_context == 'attendee') {
38
+			$this->_valid_shortcodes_modifier[$this->_context]['from'] = array(
39
+				'recipient_details',
40
+				'email',
41
+				'organization',
42
+			);
43
+		}
44 44
 
45
-        //excluded shortcodes
46
-        $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
47
-        foreach ($fields as $field) {
48
-            $this->_specific_shortcode_excludes[$field] = array(
49
-                '[RECIPIENT_REGISTRATION_CODE]',
50
-                '[EVENT_AUTHOR_FORMATTED_EMAIL]',
51
-                '[EVENT_AUTHOR_EMAIL]',
52
-            );
53
-        }
54
-        $add_excludes = array(
55
-            '[RECIPIENT_FNAME]',
56
-            '[RECIPIENT_LNAME]',
57
-            '[RECIPIENT_EMAIL]',
58
-            '[COMPANY]',
59
-            '[CO_ADD1]',
60
-            '[CO_ADD2]',
61
-            '[CO_CITY]',
62
-            '[CO_STATE]',
63
-            '[CO_ZIP]',
64
-            '[CO_LOGO]',
65
-            '[CO_PHONE]',
66
-            '[CO_LOGO_URL]',
67
-            '[CO_FACEBOOK_URL]',
68
-            '[CO_TWITTER_URL]',
69
-            '[CO_PINTEREST_URL]',
70
-            '[CO_GOOGLE_URL]',
71
-            '[CO_LINKEDIN_URL]',
72
-            '[CO_INSTAGRAM_URL]',
73
-        );
74
-        $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'],
75
-            $add_excludes);
76
-        $this->_specific_shortcode_excludes['content'] = array_merge($this->_specific_shortcode_excludes['content'],
77
-            array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'));
78
-    }
45
+		//excluded shortcodes
46
+		$fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
47
+		foreach ($fields as $field) {
48
+			$this->_specific_shortcode_excludes[$field] = array(
49
+				'[RECIPIENT_REGISTRATION_CODE]',
50
+				'[EVENT_AUTHOR_FORMATTED_EMAIL]',
51
+				'[EVENT_AUTHOR_EMAIL]',
52
+			);
53
+		}
54
+		$add_excludes = array(
55
+			'[RECIPIENT_FNAME]',
56
+			'[RECIPIENT_LNAME]',
57
+			'[RECIPIENT_EMAIL]',
58
+			'[COMPANY]',
59
+			'[CO_ADD1]',
60
+			'[CO_ADD2]',
61
+			'[CO_CITY]',
62
+			'[CO_STATE]',
63
+			'[CO_ZIP]',
64
+			'[CO_LOGO]',
65
+			'[CO_PHONE]',
66
+			'[CO_LOGO_URL]',
67
+			'[CO_FACEBOOK_URL]',
68
+			'[CO_TWITTER_URL]',
69
+			'[CO_PINTEREST_URL]',
70
+			'[CO_GOOGLE_URL]',
71
+			'[CO_LINKEDIN_URL]',
72
+			'[CO_INSTAGRAM_URL]',
73
+		);
74
+		$this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'],
75
+			$add_excludes);
76
+		$this->_specific_shortcode_excludes['content'] = array_merge($this->_specific_shortcode_excludes['content'],
77
+			array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'));
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @subpackage      helpers
7 7
  * @since           4.3.0
8 8
  */
9
-if (! defined('EVENT_ESPRESSO_VERSION')) {
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10 10
     exit('No direct script access allowed');
11 11
 }
12 12
 
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 2 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since           4.3.0
8 8
  */
9 9
 if (! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 /**
@@ -23,152 +23,152 @@  discard block
 block discarded – undo
23 23
 class EE_Newsletter_message_type extends EE_message_type
24 24
 {
25 25
 
26
-    public function __construct()
27
-    {
28
-        $this->name = 'newsletter';
29
-        $this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
30
-            'event_espresso');
31
-        $this->label = array(
32
-            'singular' => __('batch', 'event_espresso'),
33
-            'plural'   => __('batches', 'event_espresso'),
34
-        );
35
-        $this->_master_templates = array(
36
-            'email' => 'registration',
37
-        );
38
-
39
-        parent::__construct();
40
-    }
41
-
42
-
43
-    protected function _set_admin_pages()
44
-    {
45
-        $this->admin_registered_pages = array(); //no admin pages to register this with.
46
-    }
47
-
48
-
49
-    protected function _set_data_handler()
50
-    {
51
-        $this->_data_handler = 'Registrations';
52
-        $this->_single_message = $this->_data instanceof EE_Registration;
53
-    }
54
-
55
-
56
-    protected function _get_data_for_context($context, EE_Registration $registration, $id)
57
-    {
58
-        //newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
59
-        return array($registration);
60
-    }
61
-
62
-
63
-    protected function _set_admin_settings_fields()
64
-    {
65
-        $this->_admin_settings_fields = array();
66
-    }
67
-
68
-
69
-    protected function _set_contexts()
70
-    {
71
-        $this->_context_label = array(
72
-            'label'       => __('recipient', 'event_espresso'),
73
-            'plural'      => __('recipients', 'event_espresso'),
74
-            'description' => __('Recipient\'s are who will receive the message.', 'event_espresso'),
75
-        );
76
-
77
-        $this->_contexts = array(
78
-            'attendee' => array(
79
-                'label'       => __('Registrant', 'event_espresso'),
80
-                'description' => __('This template goes to selected registrants.', 'event_espresso'),
81
-            ),
82
-        );
83
-    }
84
-
85
-
86
-    /**
87
-     * used to set the valid shortcodes.
88
-     * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
89
-     * organization.  That's it!
90
-     *
91
-     * @since   4.3.0
92
-     * @return  void
93
-     */
94
-    protected function _set_valid_shortcodes()
95
-    {
96
-        parent::_set_valid_shortcodes();
97
-
98
-        $included_shortcodes = array(
99
-            'recipient_details',
100
-            'organization',
101
-            'newsletter',
102
-        );
103
-
104
-        foreach ($this->_valid_shortcodes as $context => $shortcodes) {
105
-            foreach ($shortcodes as $key => $shortcode) {
106
-                if (! in_array($shortcode, $included_shortcodes)) {
107
-                    unset($this->_valid_shortcodes[$context][$key]);
108
-                }
109
-            }
110
-            $this->_valid_shortcodes[$context][] = 'newsletter';
111
-        }
112
-
113
-    }
114
-
115
-
116
-    /**
117
-     * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
118
-     * for EE_message_type.
119
-     */
120
-    protected function _attendee_addressees()
121
-    {
122
-        $addressee = array();
123
-
124
-        //looping through registrations
125
-        foreach ($this->_data->registrations as $reg_id => $details) {
126
-            //set $attendee array to blank on each loop
127
-            $aee = array();
128
-
129
-            //need to get the attendee from this registration.
130
-            $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
131
-                ? $details['att_obj']
132
-                : null;
133
-
134
-            if (! $attendee instanceof EE_Attendee) {
135
-                continue;
136
-            }
137
-
138
-            //set $aee from attendee object
139
-            $aee['att_obj'] = $attendee;
140
-            $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
141
-                ? $this->_data->attendees[$attendee->ID()]['reg_objs']
142
-                : array();
143
-            $aee['attendee_email'] = $attendee->email();
144
-            $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
145
-                ? $this->_data->attendees[$attendee->ID()]['tkt_objs']
146
-                : array();
147
-
148
-            if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
149
-                $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
150
-                $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
151
-            } else {
152
-                $aee['evt_objs'] = $aee['events'] = array();
153
-            }
154
-
155
-            $aee['reg_obj'] = isset($details['reg_obj'])
156
-                ? $details['reg_obj']
157
-                : null;
158
-            $aee['attendees'] = $this->_data->attendees;
159
-
160
-            //merge in the primary attendee data
161
-            $aee = array_merge($this->_default_addressee_data, $aee);
162
-
163
-            //make sure txn is set
164
-            if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
165
-                $aee['txn'] = $aee['reg_obj']->transaction();
166
-            }
167
-
168
-            $addressee[] = new EE_Messages_Addressee($aee);
169
-        }
170
-        return $addressee;
171
-    }
26
+	public function __construct()
27
+	{
28
+		$this->name = 'newsletter';
29
+		$this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
30
+			'event_espresso');
31
+		$this->label = array(
32
+			'singular' => __('batch', 'event_espresso'),
33
+			'plural'   => __('batches', 'event_espresso'),
34
+		);
35
+		$this->_master_templates = array(
36
+			'email' => 'registration',
37
+		);
38
+
39
+		parent::__construct();
40
+	}
41
+
42
+
43
+	protected function _set_admin_pages()
44
+	{
45
+		$this->admin_registered_pages = array(); //no admin pages to register this with.
46
+	}
47
+
48
+
49
+	protected function _set_data_handler()
50
+	{
51
+		$this->_data_handler = 'Registrations';
52
+		$this->_single_message = $this->_data instanceof EE_Registration;
53
+	}
54
+
55
+
56
+	protected function _get_data_for_context($context, EE_Registration $registration, $id)
57
+	{
58
+		//newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
59
+		return array($registration);
60
+	}
61
+
62
+
63
+	protected function _set_admin_settings_fields()
64
+	{
65
+		$this->_admin_settings_fields = array();
66
+	}
67
+
68
+
69
+	protected function _set_contexts()
70
+	{
71
+		$this->_context_label = array(
72
+			'label'       => __('recipient', 'event_espresso'),
73
+			'plural'      => __('recipients', 'event_espresso'),
74
+			'description' => __('Recipient\'s are who will receive the message.', 'event_espresso'),
75
+		);
76
+
77
+		$this->_contexts = array(
78
+			'attendee' => array(
79
+				'label'       => __('Registrant', 'event_espresso'),
80
+				'description' => __('This template goes to selected registrants.', 'event_espresso'),
81
+			),
82
+		);
83
+	}
84
+
85
+
86
+	/**
87
+	 * used to set the valid shortcodes.
88
+	 * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
89
+	 * organization.  That's it!
90
+	 *
91
+	 * @since   4.3.0
92
+	 * @return  void
93
+	 */
94
+	protected function _set_valid_shortcodes()
95
+	{
96
+		parent::_set_valid_shortcodes();
97
+
98
+		$included_shortcodes = array(
99
+			'recipient_details',
100
+			'organization',
101
+			'newsletter',
102
+		);
103
+
104
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
105
+			foreach ($shortcodes as $key => $shortcode) {
106
+				if (! in_array($shortcode, $included_shortcodes)) {
107
+					unset($this->_valid_shortcodes[$context][$key]);
108
+				}
109
+			}
110
+			$this->_valid_shortcodes[$context][] = 'newsletter';
111
+		}
112
+
113
+	}
114
+
115
+
116
+	/**
117
+	 * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
118
+	 * for EE_message_type.
119
+	 */
120
+	protected function _attendee_addressees()
121
+	{
122
+		$addressee = array();
123
+
124
+		//looping through registrations
125
+		foreach ($this->_data->registrations as $reg_id => $details) {
126
+			//set $attendee array to blank on each loop
127
+			$aee = array();
128
+
129
+			//need to get the attendee from this registration.
130
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
131
+				? $details['att_obj']
132
+				: null;
133
+
134
+			if (! $attendee instanceof EE_Attendee) {
135
+				continue;
136
+			}
137
+
138
+			//set $aee from attendee object
139
+			$aee['att_obj'] = $attendee;
140
+			$aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
141
+				? $this->_data->attendees[$attendee->ID()]['reg_objs']
142
+				: array();
143
+			$aee['attendee_email'] = $attendee->email();
144
+			$aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
145
+				? $this->_data->attendees[$attendee->ID()]['tkt_objs']
146
+				: array();
147
+
148
+			if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
149
+				$aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
150
+				$aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
151
+			} else {
152
+				$aee['evt_objs'] = $aee['events'] = array();
153
+			}
154
+
155
+			$aee['reg_obj'] = isset($details['reg_obj'])
156
+				? $details['reg_obj']
157
+				: null;
158
+			$aee['attendees'] = $this->_data->attendees;
159
+
160
+			//merge in the primary attendee data
161
+			$aee = array_merge($this->_default_addressee_data, $aee);
162
+
163
+			//make sure txn is set
164
+			if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
165
+				$aee['txn'] = $aee['reg_obj']->transaction();
166
+			}
167
+
168
+			$addressee[] = new EE_Messages_Addressee($aee);
169
+		}
170
+		return $addressee;
171
+	}
172 172
 
173 173
 
174 174
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage      helpers
7 7
  * @since           4.3.0
8 8
  */
9
-if (! defined('EVENT_ESPRESSO_VERSION')) {
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10 10
     exit('No direct script access allowed');
11 11
 }
12 12
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         foreach ($this->_valid_shortcodes as $context => $shortcodes) {
105 105
             foreach ($shortcodes as $key => $shortcode) {
106
-                if (! in_array($shortcode, $included_shortcodes)) {
106
+                if ( ! in_array($shortcode, $included_shortcodes)) {
107 107
                     unset($this->_valid_shortcodes[$context][$key]);
108 108
                 }
109 109
             }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                 ? $details['att_obj']
132 132
                 : null;
133 133
 
134
-            if (! $attendee instanceof EE_Attendee) {
134
+            if ( ! $attendee instanceof EE_Attendee) {
135 135
                 continue;
136 136
             }
137 137
 
Please login to merge, or discard this patch.