Completed
Branch master (e3393d)
by
unknown
27:01 queued 19:45
created
espresso.php 1 patch
Indentation   +80 added lines, -80 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
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '7.2.0');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '7.2.0');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
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.10.45.rc.003');
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.10.45.rc.003');
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
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_classes/EE_Venue.class.php 1 patch
Indentation   +670 added lines, -670 removed lines patch added patch discarded remove patch
@@ -13,674 +13,674 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Venue extends EE_CPT_Base implements AddressInterface
15 15
 {
16
-    /**
17
-     * @param array  $props_n_values          incoming values
18
-     * @param string|null $timezone           incoming timezone (if not set the timezone set for the website
19
-     *                                        will be
20
-     *                                        used.)
21
-     * @param array  $date_formats            incoming date_formats in an array where the first value is the
22
-     *                                        date_format and the second value is the time format
23
-     * @return EE_Venue
24
-     * @throws EE_Error
25
-     * @throws ReflectionException
26
-     */
27
-    public static function new_instance(
28
-        array $props_n_values = [],
29
-        ?string $timezone = '',
30
-        array $date_formats = []
31
-    ): EE_Venue {
32
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
33
-        return $has_object ?: new self($props_n_values, false, $timezone, $date_formats);
34
-    }
35
-
36
-
37
-    /**
38
-     * @param array  $props_n_values  incoming values from the database
39
-     * @param string|null $timezone   incoming timezone as set by the model.
40
-     *                                If not set the timezone for the website will be used.
41
-     * @return EE_Venue
42
-     * @throws EE_Error
43
-     * @throws ReflectionException
44
-     */
45
-    public static function new_instance_from_db(array $props_n_values = [], ?string $timezone = ''): EE_Venue
46
-    {
47
-        return new self($props_n_values, true, $timezone);
48
-    }
49
-
50
-
51
-    /**
52
-     * Gets name
53
-     *
54
-     * @return string
55
-     * @throws EE_Error
56
-     * @throws ReflectionException
57
-     */
58
-    public function name(): string
59
-    {
60
-        return (string) $this->get('VNU_name');
61
-    }
62
-
63
-
64
-    /**
65
-     * Gets phone
66
-     *
67
-     * @return string
68
-     * @throws EE_Error
69
-     * @throws ReflectionException
70
-     */
71
-    public function phone(): string
72
-    {
73
-        return (string) $this->get('VNU_phone');
74
-    }
75
-
76
-
77
-    /**
78
-     * venue_url
79
-     *
80
-     * @return string
81
-     * @throws EE_Error
82
-     * @throws ReflectionException
83
-     */
84
-    public function venue_url(): string
85
-    {
86
-        return (string) $this->get('VNU_url');
87
-    }
88
-
89
-
90
-    /**
91
-     * Gets desc
92
-     *
93
-     * @return string
94
-     * @throws EE_Error
95
-     * @throws ReflectionException
96
-     */
97
-    public function description(): string
98
-    {
99
-        return (string) $this->get('VNU_desc');
100
-    }
101
-
102
-
103
-    /**
104
-     * Gets short description (AKA: the excerpt)
105
-     *
106
-     * @return string
107
-     * @throws EE_Error
108
-     * @throws ReflectionException
109
-     */
110
-    public function excerpt(): string
111
-    {
112
-        return (string) $this->get('VNU_short_desc');
113
-    }
114
-
115
-
116
-    /**
117
-     * Gets identifier
118
-     *
119
-     * @return string
120
-     * @throws EE_Error
121
-     * @throws ReflectionException
122
-     */
123
-    public function identifier(): string
124
-    {
125
-        return (string) $this->get('VNU_identifier');
126
-    }
127
-
128
-
129
-    /**
130
-     * Gets address
131
-     *
132
-     * @return string
133
-     * @throws EE_Error
134
-     * @throws ReflectionException
135
-     */
136
-    public function address(): string
137
-    {
138
-        return (string) $this->get('VNU_address');
139
-    }
140
-
141
-
142
-    /**
143
-     * Gets address2
144
-     *
145
-     * @return string
146
-     * @throws EE_Error
147
-     * @throws ReflectionException
148
-     */
149
-    public function address2(): string
150
-    {
151
-        return (string) $this->get('VNU_address2');
152
-    }
153
-
154
-
155
-    /**
156
-     * Gets city
157
-     *
158
-     * @return string
159
-     * @throws EE_Error
160
-     * @throws ReflectionException
161
-     */
162
-    public function city(): string
163
-    {
164
-        return (string) $this->get('VNU_city');
165
-    }
166
-
167
-
168
-    /**
169
-     * Gets state
170
-     *
171
-     * @return int
172
-     * @throws EE_Error
173
-     * @throws ReflectionException
174
-     */
175
-    public function state_ID(): int
176
-    {
177
-        return (int) $this->get('STA_ID');
178
-    }
179
-
180
-
181
-    /**
182
-     * @return string
183
-     * @throws EE_Error
184
-     * @throws ReflectionException
185
-     */
186
-    public function state_abbrev(): string
187
-    {
188
-        return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : '';
189
-    }
190
-
191
-
192
-    /**
193
-     * @return string
194
-     * @throws EE_Error
195
-     * @throws ReflectionException
196
-     */
197
-    public function state_name(): string
198
-    {
199
-        return $this->state_obj() instanceof EE_State
200
-            ? (string) $this->state_obj()->name()
201
-            : '';
202
-    }
203
-
204
-
205
-    /**
206
-     * Gets the state for this venue
207
-     *
208
-     * @return EE_State|null
209
-     * @throws EE_Error
210
-     * @throws ReflectionException
211
-     */
212
-    public function state_obj(): ?EE_State
213
-    {
214
-        return $this->get_first_related('State');
215
-    }
216
-
217
-
218
-    /**
219
-     * either displays the state abbreviation or the state name, as determined
220
-     * by the "FHEE__EEI_Address__state__use_abbreviation" filter.
221
-     * defaults to abbreviation
222
-     *
223
-     * @return string
224
-     * @throws EE_Error
225
-     * @throws ReflectionException
226
-     */
227
-    public function state(): string
228
-    {
229
-        return apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())
230
-            ? $this->state_abbrev()
231
-            : $this->state_name();
232
-    }
233
-
234
-
235
-    /**
236
-     * country_ID
237
-     *
238
-     * @return string
239
-     * @throws EE_Error
240
-     * @throws ReflectionException
241
-     */
242
-    public function country_ID(): string
243
-    {
244
-        return (string) $this->get('CNT_ISO');
245
-    }
246
-
247
-
248
-    /**
249
-     * @return string
250
-     * @throws EE_Error
251
-     * @throws ReflectionException
252
-     */
253
-    public function country_name(): string
254
-    {
255
-        return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : '';
256
-    }
257
-
258
-
259
-    /**
260
-     * Gets the country of this venue
261
-     *
262
-     * @return EE_Country|null
263
-     * @throws EE_Error
264
-     * @throws ReflectionException
265
-     */
266
-    public function country_obj(): ?EE_Country
267
-    {
268
-        return $this->get_first_related('Country');
269
-    }
270
-
271
-
272
-    /**
273
-     * either displays the country ISO2 code or the country name, as determined
274
-     * by the "FHEE__EEI_Address__country__use_abbreviation" filter.
275
-     * defaults to abbreviation
276
-     *
277
-     * @return string
278
-     * @throws EE_Error
279
-     * @throws ReflectionException
280
-     */
281
-    public function country(): string
282
-    {
283
-        return apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())
284
-            ? $this->country_ID()
285
-            : $this->country_name();
286
-    }
287
-
288
-
289
-    /**
290
-     * Gets zip
291
-     *
292
-     * @return string
293
-     * @throws EE_Error
294
-     * @throws ReflectionException
295
-     */
296
-    public function zip(): string
297
-    {
298
-        return $this->get('VNU_zip');
299
-    }
300
-
301
-
302
-    /**
303
-     * Gets capacity
304
-     *
305
-     * @return int|string
306
-     * @throws EE_Error
307
-     * @throws ReflectionException
308
-     */
309
-    public function capacity()
310
-    {
311
-        return $this->get_pretty('VNU_capacity', 'symbol');
312
-    }
313
-
314
-
315
-    /**
316
-     * Gets created
317
-     *
318
-     * @return string
319
-     * @throws EE_Error
320
-     * @throws ReflectionException
321
-     */
322
-    public function created(): string
323
-    {
324
-        return (string) $this->get('VNU_created');
325
-    }
326
-
327
-
328
-    /**
329
-     * Gets modified
330
-     *
331
-     * @return string
332
-     * @throws EE_Error
333
-     * @throws ReflectionException
334
-     */
335
-    public function modified(): string
336
-    {
337
-        return (string) $this->get('VNU_modified');
338
-    }
339
-
340
-
341
-    /**
342
-     * Gets order
343
-     *
344
-     * @return int
345
-     * @throws EE_Error
346
-     * @throws ReflectionException
347
-     */
348
-    public function order(): int
349
-    {
350
-        return (int) $this->get('VNU_order');
351
-    }
352
-
353
-
354
-    /**
355
-     * Gets wp_user
356
-     *
357
-     * @return int
358
-     * @throws EE_Error
359
-     * @throws ReflectionException
360
-     */
361
-    public function wp_user(): int
362
-    {
363
-        return (int) $this->get('VNU_wp_user');
364
-    }
365
-
366
-
367
-    /**
368
-     * @return string
369
-     * @throws EE_Error
370
-     * @throws ReflectionException
371
-     */
372
-    public function virtual_phone(): string
373
-    {
374
-        return (string) $this->get('VNU_virtual_phone');
375
-    }
376
-
377
-
378
-    /**
379
-     * @return string
380
-     * @throws EE_Error
381
-     * @throws ReflectionException
382
-     */
383
-    public function virtual_url(): string
384
-    {
385
-        return (string) $this->get('VNU_virtual_url');
386
-    }
387
-
388
-
389
-    /**
390
-     * @return bool
391
-     * @throws EE_Error
392
-     * @throws ReflectionException
393
-     */
394
-    public function enable_for_gmap(): bool
395
-    {
396
-        return (bool) $this->get('VNU_enable_for_gmap');
397
-    }
398
-
399
-
400
-    /**
401
-     * @return string
402
-     * @throws EE_Error
403
-     * @throws ReflectionException
404
-     */
405
-    public function google_map_link(): string
406
-    {
407
-        return (string) $this->get('VNU_google_map_link');
408
-    }
409
-
410
-
411
-    /**
412
-     * Gets all events happening at this venue. Query parameters can be added to
413
-     * fetch a subset of those events.
414
-     *
415
-     * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
416
-     * @param bool  $upcoming
417
-     * @return EE_Event[]
418
-     * @throws EE_Error
419
-     * @throws ReflectionException
420
-     */
421
-    public function events(array $query_params = array(), bool $upcoming = false): array
422
-    {
423
-        if ($upcoming) {
424
-            $query_params = array(
425
-                array(
426
-                    'status'                 => 'publish',
427
-                    'Datetime.DTT_EVT_start' => array(
428
-                        '>',
429
-                        EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'),
430
-                    ),
431
-                ),
432
-            );
433
-        }
434
-        return $this->get_many_related('Event', $query_params);
435
-    }
436
-
437
-
438
-    /**
439
-     * Sets address
440
-     *
441
-     * @param string $address
442
-     * @throws EE_Error
443
-     * @throws ReflectionException
444
-     */
445
-    public function set_address(string $address = '')
446
-    {
447
-        $this->set('VNU_address', $address);
448
-    }
449
-
450
-
451
-    /**
452
-     * @param string $address2
453
-     * @throws EE_Error
454
-     * @throws ReflectionException
455
-     */
456
-    public function set_address2(string $address2 = '')
457
-    {
458
-        $this->set('VNU_address2', $address2);
459
-    }
460
-
461
-
462
-    /**
463
-     * @param string $city
464
-     * @throws EE_Error
465
-     * @throws ReflectionException
466
-     */
467
-    public function set_city(string $city = '')
468
-    {
469
-        $this->set('VNU_city', $city);
470
-    }
471
-
472
-
473
-    /**
474
-     * @param int $state
475
-     * @throws EE_Error
476
-     * @throws ReflectionException
477
-     */
478
-    public function set_state_ID(int $state = 0)
479
-    {
480
-        $this->set('STA_ID', $state);
481
-    }
482
-
483
-
484
-    /**
485
-     * Sets the state, given either a state id or state object
486
-     *
487
-     * @param EE_State|int $state_id_or_obj
488
-     * @return EE_State
489
-     * @throws EE_Error
490
-     * @throws ReflectionException
491
-     */
492
-    public function set_state_obj($state_id_or_obj): EE_State
493
-    {
494
-        return $this->_add_relation_to($state_id_or_obj, 'State');
495
-    }
496
-
497
-
498
-    /**
499
-     * @param string $country_ID
500
-     * @throws EE_Error
501
-     * @throws ReflectionException
502
-     */
503
-    public function set_country_ID(string $country_ID = '')
504
-    {
505
-        $this->set('CNT_ISO', $country_ID);
506
-    }
507
-
508
-
509
-    /**
510
-     * Sets the country on the venue
511
-     *
512
-     * @param EE_Country|string $country_id_or_obj
513
-     * @return EE_Country
514
-     * @throws EE_Error
515
-     * @throws ReflectionException
516
-     */
517
-    public function set_country_obj($country_id_or_obj): EE_Country
518
-    {
519
-        return $this->_add_relation_to($country_id_or_obj, 'Country');
520
-    }
521
-
522
-
523
-    /**
524
-     * @param string $zip
525
-     * @throws EE_Error
526
-     * @throws ReflectionException
527
-     */
528
-    public function set_zip(string $zip = '')
529
-    {
530
-        $this->set('VNU_zip', $zip);
531
-    }
532
-
533
-
534
-    /**
535
-     * @param int $capacity
536
-     * @throws EE_Error
537
-     * @throws ReflectionException
538
-     */
539
-    public function set_capacity(int $capacity = 0)
540
-    {
541
-        $this->set('VNU_capacity', $capacity);
542
-    }
543
-
544
-
545
-    /**
546
-     * @param string $created
547
-     * @throws EE_Error
548
-     * @throws ReflectionException
549
-     */
550
-    public function set_created(string $created = '')
551
-    {
552
-        $this->set('VNU_created', $created);
553
-    }
554
-
555
-
556
-    /**
557
-     * @param string $desc
558
-     * @throws EE_Error
559
-     * @throws ReflectionException
560
-     */
561
-    public function set_description(string $desc = '')
562
-    {
563
-        $this->set('VNU_desc', $desc);
564
-    }
565
-
566
-
567
-    /**
568
-     * @param string $identifier
569
-     * @throws EE_Error
570
-     * @throws ReflectionException
571
-     */
572
-    public function set_identifier(string $identifier = '')
573
-    {
574
-        $this->set('VNU_identifier', $identifier);
575
-    }
576
-
577
-
578
-    /**
579
-     * @param string $modified
580
-     * @throws EE_Error
581
-     * @throws ReflectionException
582
-     */
583
-    public function set_modified(string $modified = '')
584
-    {
585
-        $this->set('VNU_modified', $modified);
586
-    }
587
-
588
-
589
-    /**
590
-     * @param string $name
591
-     * @throws EE_Error
592
-     * @throws ReflectionException
593
-     */
594
-    public function set_name(string $name = '')
595
-    {
596
-        $this->set('VNU_name', $name);
597
-    }
598
-
599
-
600
-    /**
601
-     * @param int $order
602
-     * @throws EE_Error
603
-     * @throws ReflectionException
604
-     */
605
-    public function set_order(int $order = 0)
606
-    {
607
-        $this->set('VNU_order', $order);
608
-    }
609
-
610
-
611
-    /**
612
-     * @param string $phone
613
-     * @throws EE_Error
614
-     * @throws ReflectionException
615
-     */
616
-    public function set_phone(string $phone = '')
617
-    {
618
-        $this->set('VNU_phone', $phone);
619
-    }
620
-
621
-
622
-    /**
623
-     * @param int $wp_user
624
-     * @throws EE_Error
625
-     * @throws ReflectionException
626
-     */
627
-    public function set_wp_user(int $wp_user = 1)
628
-    {
629
-        $this->set('VNU_wp_user', $wp_user);
630
-    }
631
-
632
-
633
-    /**
634
-     * @param string $url
635
-     * @throws EE_Error
636
-     * @throws ReflectionException
637
-     */
638
-    public function set_venue_url(string $url = '')
639
-    {
640
-        $this->set('VNU_url', $url);
641
-    }
642
-
643
-
644
-    /**
645
-     * @param string $phone
646
-     * @throws EE_Error
647
-     * @throws ReflectionException
648
-     */
649
-    public function set_virtual_phone(string $phone = '')
650
-    {
651
-        $this->set('VNU_virtual_phone', $phone);
652
-    }
653
-
654
-
655
-    /**
656
-     * @param string $url
657
-     * @throws EE_Error
658
-     * @throws ReflectionException
659
-     */
660
-    public function set_virtual_url(string $url = '')
661
-    {
662
-        $this->set('VNU_virtual_url', $url);
663
-    }
664
-
665
-
666
-    /**
667
-     * @param bool|int|string $enable
668
-     * @throws EE_Error
669
-     * @throws ReflectionException
670
-     */
671
-    public function set_enable_for_gmap($enable = false)
672
-    {
673
-        $this->set('VNU_enable_for_gmap', $enable);
674
-    }
675
-
676
-
677
-    /**
678
-     * @param string $google_map_link
679
-     * @throws EE_Error
680
-     * @throws ReflectionException
681
-     */
682
-    public function set_google_map_link(string $google_map_link = '')
683
-    {
684
-        $this->set('VNU_google_map_link', $google_map_link);
685
-    }
16
+	/**
17
+	 * @param array  $props_n_values          incoming values
18
+	 * @param string|null $timezone           incoming timezone (if not set the timezone set for the website
19
+	 *                                        will be
20
+	 *                                        used.)
21
+	 * @param array  $date_formats            incoming date_formats in an array where the first value is the
22
+	 *                                        date_format and the second value is the time format
23
+	 * @return EE_Venue
24
+	 * @throws EE_Error
25
+	 * @throws ReflectionException
26
+	 */
27
+	public static function new_instance(
28
+		array $props_n_values = [],
29
+		?string $timezone = '',
30
+		array $date_formats = []
31
+	): EE_Venue {
32
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
33
+		return $has_object ?: new self($props_n_values, false, $timezone, $date_formats);
34
+	}
35
+
36
+
37
+	/**
38
+	 * @param array  $props_n_values  incoming values from the database
39
+	 * @param string|null $timezone   incoming timezone as set by the model.
40
+	 *                                If not set the timezone for the website will be used.
41
+	 * @return EE_Venue
42
+	 * @throws EE_Error
43
+	 * @throws ReflectionException
44
+	 */
45
+	public static function new_instance_from_db(array $props_n_values = [], ?string $timezone = ''): EE_Venue
46
+	{
47
+		return new self($props_n_values, true, $timezone);
48
+	}
49
+
50
+
51
+	/**
52
+	 * Gets name
53
+	 *
54
+	 * @return string
55
+	 * @throws EE_Error
56
+	 * @throws ReflectionException
57
+	 */
58
+	public function name(): string
59
+	{
60
+		return (string) $this->get('VNU_name');
61
+	}
62
+
63
+
64
+	/**
65
+	 * Gets phone
66
+	 *
67
+	 * @return string
68
+	 * @throws EE_Error
69
+	 * @throws ReflectionException
70
+	 */
71
+	public function phone(): string
72
+	{
73
+		return (string) $this->get('VNU_phone');
74
+	}
75
+
76
+
77
+	/**
78
+	 * venue_url
79
+	 *
80
+	 * @return string
81
+	 * @throws EE_Error
82
+	 * @throws ReflectionException
83
+	 */
84
+	public function venue_url(): string
85
+	{
86
+		return (string) $this->get('VNU_url');
87
+	}
88
+
89
+
90
+	/**
91
+	 * Gets desc
92
+	 *
93
+	 * @return string
94
+	 * @throws EE_Error
95
+	 * @throws ReflectionException
96
+	 */
97
+	public function description(): string
98
+	{
99
+		return (string) $this->get('VNU_desc');
100
+	}
101
+
102
+
103
+	/**
104
+	 * Gets short description (AKA: the excerpt)
105
+	 *
106
+	 * @return string
107
+	 * @throws EE_Error
108
+	 * @throws ReflectionException
109
+	 */
110
+	public function excerpt(): string
111
+	{
112
+		return (string) $this->get('VNU_short_desc');
113
+	}
114
+
115
+
116
+	/**
117
+	 * Gets identifier
118
+	 *
119
+	 * @return string
120
+	 * @throws EE_Error
121
+	 * @throws ReflectionException
122
+	 */
123
+	public function identifier(): string
124
+	{
125
+		return (string) $this->get('VNU_identifier');
126
+	}
127
+
128
+
129
+	/**
130
+	 * Gets address
131
+	 *
132
+	 * @return string
133
+	 * @throws EE_Error
134
+	 * @throws ReflectionException
135
+	 */
136
+	public function address(): string
137
+	{
138
+		return (string) $this->get('VNU_address');
139
+	}
140
+
141
+
142
+	/**
143
+	 * Gets address2
144
+	 *
145
+	 * @return string
146
+	 * @throws EE_Error
147
+	 * @throws ReflectionException
148
+	 */
149
+	public function address2(): string
150
+	{
151
+		return (string) $this->get('VNU_address2');
152
+	}
153
+
154
+
155
+	/**
156
+	 * Gets city
157
+	 *
158
+	 * @return string
159
+	 * @throws EE_Error
160
+	 * @throws ReflectionException
161
+	 */
162
+	public function city(): string
163
+	{
164
+		return (string) $this->get('VNU_city');
165
+	}
166
+
167
+
168
+	/**
169
+	 * Gets state
170
+	 *
171
+	 * @return int
172
+	 * @throws EE_Error
173
+	 * @throws ReflectionException
174
+	 */
175
+	public function state_ID(): int
176
+	{
177
+		return (int) $this->get('STA_ID');
178
+	}
179
+
180
+
181
+	/**
182
+	 * @return string
183
+	 * @throws EE_Error
184
+	 * @throws ReflectionException
185
+	 */
186
+	public function state_abbrev(): string
187
+	{
188
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : '';
189
+	}
190
+
191
+
192
+	/**
193
+	 * @return string
194
+	 * @throws EE_Error
195
+	 * @throws ReflectionException
196
+	 */
197
+	public function state_name(): string
198
+	{
199
+		return $this->state_obj() instanceof EE_State
200
+			? (string) $this->state_obj()->name()
201
+			: '';
202
+	}
203
+
204
+
205
+	/**
206
+	 * Gets the state for this venue
207
+	 *
208
+	 * @return EE_State|null
209
+	 * @throws EE_Error
210
+	 * @throws ReflectionException
211
+	 */
212
+	public function state_obj(): ?EE_State
213
+	{
214
+		return $this->get_first_related('State');
215
+	}
216
+
217
+
218
+	/**
219
+	 * either displays the state abbreviation or the state name, as determined
220
+	 * by the "FHEE__EEI_Address__state__use_abbreviation" filter.
221
+	 * defaults to abbreviation
222
+	 *
223
+	 * @return string
224
+	 * @throws EE_Error
225
+	 * @throws ReflectionException
226
+	 */
227
+	public function state(): string
228
+	{
229
+		return apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())
230
+			? $this->state_abbrev()
231
+			: $this->state_name();
232
+	}
233
+
234
+
235
+	/**
236
+	 * country_ID
237
+	 *
238
+	 * @return string
239
+	 * @throws EE_Error
240
+	 * @throws ReflectionException
241
+	 */
242
+	public function country_ID(): string
243
+	{
244
+		return (string) $this->get('CNT_ISO');
245
+	}
246
+
247
+
248
+	/**
249
+	 * @return string
250
+	 * @throws EE_Error
251
+	 * @throws ReflectionException
252
+	 */
253
+	public function country_name(): string
254
+	{
255
+		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : '';
256
+	}
257
+
258
+
259
+	/**
260
+	 * Gets the country of this venue
261
+	 *
262
+	 * @return EE_Country|null
263
+	 * @throws EE_Error
264
+	 * @throws ReflectionException
265
+	 */
266
+	public function country_obj(): ?EE_Country
267
+	{
268
+		return $this->get_first_related('Country');
269
+	}
270
+
271
+
272
+	/**
273
+	 * either displays the country ISO2 code or the country name, as determined
274
+	 * by the "FHEE__EEI_Address__country__use_abbreviation" filter.
275
+	 * defaults to abbreviation
276
+	 *
277
+	 * @return string
278
+	 * @throws EE_Error
279
+	 * @throws ReflectionException
280
+	 */
281
+	public function country(): string
282
+	{
283
+		return apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())
284
+			? $this->country_ID()
285
+			: $this->country_name();
286
+	}
287
+
288
+
289
+	/**
290
+	 * Gets zip
291
+	 *
292
+	 * @return string
293
+	 * @throws EE_Error
294
+	 * @throws ReflectionException
295
+	 */
296
+	public function zip(): string
297
+	{
298
+		return $this->get('VNU_zip');
299
+	}
300
+
301
+
302
+	/**
303
+	 * Gets capacity
304
+	 *
305
+	 * @return int|string
306
+	 * @throws EE_Error
307
+	 * @throws ReflectionException
308
+	 */
309
+	public function capacity()
310
+	{
311
+		return $this->get_pretty('VNU_capacity', 'symbol');
312
+	}
313
+
314
+
315
+	/**
316
+	 * Gets created
317
+	 *
318
+	 * @return string
319
+	 * @throws EE_Error
320
+	 * @throws ReflectionException
321
+	 */
322
+	public function created(): string
323
+	{
324
+		return (string) $this->get('VNU_created');
325
+	}
326
+
327
+
328
+	/**
329
+	 * Gets modified
330
+	 *
331
+	 * @return string
332
+	 * @throws EE_Error
333
+	 * @throws ReflectionException
334
+	 */
335
+	public function modified(): string
336
+	{
337
+		return (string) $this->get('VNU_modified');
338
+	}
339
+
340
+
341
+	/**
342
+	 * Gets order
343
+	 *
344
+	 * @return int
345
+	 * @throws EE_Error
346
+	 * @throws ReflectionException
347
+	 */
348
+	public function order(): int
349
+	{
350
+		return (int) $this->get('VNU_order');
351
+	}
352
+
353
+
354
+	/**
355
+	 * Gets wp_user
356
+	 *
357
+	 * @return int
358
+	 * @throws EE_Error
359
+	 * @throws ReflectionException
360
+	 */
361
+	public function wp_user(): int
362
+	{
363
+		return (int) $this->get('VNU_wp_user');
364
+	}
365
+
366
+
367
+	/**
368
+	 * @return string
369
+	 * @throws EE_Error
370
+	 * @throws ReflectionException
371
+	 */
372
+	public function virtual_phone(): string
373
+	{
374
+		return (string) $this->get('VNU_virtual_phone');
375
+	}
376
+
377
+
378
+	/**
379
+	 * @return string
380
+	 * @throws EE_Error
381
+	 * @throws ReflectionException
382
+	 */
383
+	public function virtual_url(): string
384
+	{
385
+		return (string) $this->get('VNU_virtual_url');
386
+	}
387
+
388
+
389
+	/**
390
+	 * @return bool
391
+	 * @throws EE_Error
392
+	 * @throws ReflectionException
393
+	 */
394
+	public function enable_for_gmap(): bool
395
+	{
396
+		return (bool) $this->get('VNU_enable_for_gmap');
397
+	}
398
+
399
+
400
+	/**
401
+	 * @return string
402
+	 * @throws EE_Error
403
+	 * @throws ReflectionException
404
+	 */
405
+	public function google_map_link(): string
406
+	{
407
+		return (string) $this->get('VNU_google_map_link');
408
+	}
409
+
410
+
411
+	/**
412
+	 * Gets all events happening at this venue. Query parameters can be added to
413
+	 * fetch a subset of those events.
414
+	 *
415
+	 * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
416
+	 * @param bool  $upcoming
417
+	 * @return EE_Event[]
418
+	 * @throws EE_Error
419
+	 * @throws ReflectionException
420
+	 */
421
+	public function events(array $query_params = array(), bool $upcoming = false): array
422
+	{
423
+		if ($upcoming) {
424
+			$query_params = array(
425
+				array(
426
+					'status'                 => 'publish',
427
+					'Datetime.DTT_EVT_start' => array(
428
+						'>',
429
+						EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'),
430
+					),
431
+				),
432
+			);
433
+		}
434
+		return $this->get_many_related('Event', $query_params);
435
+	}
436
+
437
+
438
+	/**
439
+	 * Sets address
440
+	 *
441
+	 * @param string $address
442
+	 * @throws EE_Error
443
+	 * @throws ReflectionException
444
+	 */
445
+	public function set_address(string $address = '')
446
+	{
447
+		$this->set('VNU_address', $address);
448
+	}
449
+
450
+
451
+	/**
452
+	 * @param string $address2
453
+	 * @throws EE_Error
454
+	 * @throws ReflectionException
455
+	 */
456
+	public function set_address2(string $address2 = '')
457
+	{
458
+		$this->set('VNU_address2', $address2);
459
+	}
460
+
461
+
462
+	/**
463
+	 * @param string $city
464
+	 * @throws EE_Error
465
+	 * @throws ReflectionException
466
+	 */
467
+	public function set_city(string $city = '')
468
+	{
469
+		$this->set('VNU_city', $city);
470
+	}
471
+
472
+
473
+	/**
474
+	 * @param int $state
475
+	 * @throws EE_Error
476
+	 * @throws ReflectionException
477
+	 */
478
+	public function set_state_ID(int $state = 0)
479
+	{
480
+		$this->set('STA_ID', $state);
481
+	}
482
+
483
+
484
+	/**
485
+	 * Sets the state, given either a state id or state object
486
+	 *
487
+	 * @param EE_State|int $state_id_or_obj
488
+	 * @return EE_State
489
+	 * @throws EE_Error
490
+	 * @throws ReflectionException
491
+	 */
492
+	public function set_state_obj($state_id_or_obj): EE_State
493
+	{
494
+		return $this->_add_relation_to($state_id_or_obj, 'State');
495
+	}
496
+
497
+
498
+	/**
499
+	 * @param string $country_ID
500
+	 * @throws EE_Error
501
+	 * @throws ReflectionException
502
+	 */
503
+	public function set_country_ID(string $country_ID = '')
504
+	{
505
+		$this->set('CNT_ISO', $country_ID);
506
+	}
507
+
508
+
509
+	/**
510
+	 * Sets the country on the venue
511
+	 *
512
+	 * @param EE_Country|string $country_id_or_obj
513
+	 * @return EE_Country
514
+	 * @throws EE_Error
515
+	 * @throws ReflectionException
516
+	 */
517
+	public function set_country_obj($country_id_or_obj): EE_Country
518
+	{
519
+		return $this->_add_relation_to($country_id_or_obj, 'Country');
520
+	}
521
+
522
+
523
+	/**
524
+	 * @param string $zip
525
+	 * @throws EE_Error
526
+	 * @throws ReflectionException
527
+	 */
528
+	public function set_zip(string $zip = '')
529
+	{
530
+		$this->set('VNU_zip', $zip);
531
+	}
532
+
533
+
534
+	/**
535
+	 * @param int $capacity
536
+	 * @throws EE_Error
537
+	 * @throws ReflectionException
538
+	 */
539
+	public function set_capacity(int $capacity = 0)
540
+	{
541
+		$this->set('VNU_capacity', $capacity);
542
+	}
543
+
544
+
545
+	/**
546
+	 * @param string $created
547
+	 * @throws EE_Error
548
+	 * @throws ReflectionException
549
+	 */
550
+	public function set_created(string $created = '')
551
+	{
552
+		$this->set('VNU_created', $created);
553
+	}
554
+
555
+
556
+	/**
557
+	 * @param string $desc
558
+	 * @throws EE_Error
559
+	 * @throws ReflectionException
560
+	 */
561
+	public function set_description(string $desc = '')
562
+	{
563
+		$this->set('VNU_desc', $desc);
564
+	}
565
+
566
+
567
+	/**
568
+	 * @param string $identifier
569
+	 * @throws EE_Error
570
+	 * @throws ReflectionException
571
+	 */
572
+	public function set_identifier(string $identifier = '')
573
+	{
574
+		$this->set('VNU_identifier', $identifier);
575
+	}
576
+
577
+
578
+	/**
579
+	 * @param string $modified
580
+	 * @throws EE_Error
581
+	 * @throws ReflectionException
582
+	 */
583
+	public function set_modified(string $modified = '')
584
+	{
585
+		$this->set('VNU_modified', $modified);
586
+	}
587
+
588
+
589
+	/**
590
+	 * @param string $name
591
+	 * @throws EE_Error
592
+	 * @throws ReflectionException
593
+	 */
594
+	public function set_name(string $name = '')
595
+	{
596
+		$this->set('VNU_name', $name);
597
+	}
598
+
599
+
600
+	/**
601
+	 * @param int $order
602
+	 * @throws EE_Error
603
+	 * @throws ReflectionException
604
+	 */
605
+	public function set_order(int $order = 0)
606
+	{
607
+		$this->set('VNU_order', $order);
608
+	}
609
+
610
+
611
+	/**
612
+	 * @param string $phone
613
+	 * @throws EE_Error
614
+	 * @throws ReflectionException
615
+	 */
616
+	public function set_phone(string $phone = '')
617
+	{
618
+		$this->set('VNU_phone', $phone);
619
+	}
620
+
621
+
622
+	/**
623
+	 * @param int $wp_user
624
+	 * @throws EE_Error
625
+	 * @throws ReflectionException
626
+	 */
627
+	public function set_wp_user(int $wp_user = 1)
628
+	{
629
+		$this->set('VNU_wp_user', $wp_user);
630
+	}
631
+
632
+
633
+	/**
634
+	 * @param string $url
635
+	 * @throws EE_Error
636
+	 * @throws ReflectionException
637
+	 */
638
+	public function set_venue_url(string $url = '')
639
+	{
640
+		$this->set('VNU_url', $url);
641
+	}
642
+
643
+
644
+	/**
645
+	 * @param string $phone
646
+	 * @throws EE_Error
647
+	 * @throws ReflectionException
648
+	 */
649
+	public function set_virtual_phone(string $phone = '')
650
+	{
651
+		$this->set('VNU_virtual_phone', $phone);
652
+	}
653
+
654
+
655
+	/**
656
+	 * @param string $url
657
+	 * @throws EE_Error
658
+	 * @throws ReflectionException
659
+	 */
660
+	public function set_virtual_url(string $url = '')
661
+	{
662
+		$this->set('VNU_virtual_url', $url);
663
+	}
664
+
665
+
666
+	/**
667
+	 * @param bool|int|string $enable
668
+	 * @throws EE_Error
669
+	 * @throws ReflectionException
670
+	 */
671
+	public function set_enable_for_gmap($enable = false)
672
+	{
673
+		$this->set('VNU_enable_for_gmap', $enable);
674
+	}
675
+
676
+
677
+	/**
678
+	 * @param string $google_map_link
679
+	 * @throws EE_Error
680
+	 * @throws ReflectionException
681
+	 */
682
+	public function set_google_map_link(string $google_map_link = '')
683
+	{
684
+		$this->set('VNU_google_map_link', $google_map_link);
685
+	}
686 686
 }
Please login to merge, or discard this patch.