Completed
Branch dependabot/composer/jaybizzle/... (2225bb)
by
unknown
04:46 queued 19s
created
core/domain/Domain.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@
 block discarded – undo
63 63
      */
64 64
     private function setCaffeinated()
65 65
     {
66
-        $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true)
67
-            && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php');
66
+        $this->caffeinated = ( ! defined('EE_DECAF') || EE_DECAF !== true)
67
+            && is_readable($this->pluginPath().'caffeinated/brewing_regular.php');
68 68
     }
69 69
 
70 70
 
Please login to merge, or discard this patch.
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -15,87 +15,87 @@
 block discarded – undo
15 15
  */
16 16
 class Domain extends DomainBase implements CaffeinatedInterface
17 17
 {
18
-    /**
19
-     * URL path component used to denote an API request
20
-     */
21
-    const API_NAMESPACE = 'ee/v';
22
-
23
-    const ASSET_NAMESPACE = 'eventespresso';
24
-
25
-    const TEXT_DOMAIN = 'event_espresso';
26
-
27
-    /**
28
-     * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin
29
-     * Page ui.
30
-     */
31
-    const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN
32
-        = 'manual_registration_status_change_from_registration_admin';
33
-
34
-    const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
35
-        = 'manual_registration_status_change_from_registration_admin_and_notify';
36
-
37
-
38
-    /**
39
-     * Whether or not EE core is the full premium version.
40
-     * @since 4.9.59.p
41
-     * @var bool
42
-     */
43
-    private $caffeinated;
44
-
45
-    /**
46
-     * @since 5.0.0.p
47
-     * @var bool
48
-     */
49
-    private $multisite;
50
-
51
-
52
-    public function __construct(FilePath $plugin_file, Version $version)
53
-    {
54
-        parent::__construct($plugin_file, $version);
55
-        $this->setCaffeinated();
56
-        $this->multisite = is_multisite();
57
-    }
58
-
59
-    /**
60
-     * Whether or not EE core is the full premium version.
61
-     * @since 4.9.59.p
62
-     * @return bool
63
-     */
64
-    public function isCaffeinated()
65
-    {
66
-        return $this->caffeinated;
67
-    }
68
-
69
-
70
-    /**
71
-     * Setter for $is_caffeinated property.
72
-     * @since 4.9.59.p
73
-     */
74
-    private function setCaffeinated()
75
-    {
76
-        $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true)
77
-            && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php');
78
-    }
79
-
80
-
81
-    /**
82
-     * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces
83
-     * to allow for filtering the brand.
84
-     *
85
-     * @return string
86
-     */
87
-    public static function brandName()
88
-    {
89
-        return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso');
90
-    }
91
-
92
-
93
-    /**
94
-     * @return bool
95
-     * @since 5.0.0.p
96
-     */
97
-    public function isMultiSite(): bool
98
-    {
99
-        return $this->multisite;
100
-    }
18
+	/**
19
+	 * URL path component used to denote an API request
20
+	 */
21
+	const API_NAMESPACE = 'ee/v';
22
+
23
+	const ASSET_NAMESPACE = 'eventespresso';
24
+
25
+	const TEXT_DOMAIN = 'event_espresso';
26
+
27
+	/**
28
+	 * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin
29
+	 * Page ui.
30
+	 */
31
+	const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN
32
+		= 'manual_registration_status_change_from_registration_admin';
33
+
34
+	const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
35
+		= 'manual_registration_status_change_from_registration_admin_and_notify';
36
+
37
+
38
+	/**
39
+	 * Whether or not EE core is the full premium version.
40
+	 * @since 4.9.59.p
41
+	 * @var bool
42
+	 */
43
+	private $caffeinated;
44
+
45
+	/**
46
+	 * @since 5.0.0.p
47
+	 * @var bool
48
+	 */
49
+	private $multisite;
50
+
51
+
52
+	public function __construct(FilePath $plugin_file, Version $version)
53
+	{
54
+		parent::__construct($plugin_file, $version);
55
+		$this->setCaffeinated();
56
+		$this->multisite = is_multisite();
57
+	}
58
+
59
+	/**
60
+	 * Whether or not EE core is the full premium version.
61
+	 * @since 4.9.59.p
62
+	 * @return bool
63
+	 */
64
+	public function isCaffeinated()
65
+	{
66
+		return $this->caffeinated;
67
+	}
68
+
69
+
70
+	/**
71
+	 * Setter for $is_caffeinated property.
72
+	 * @since 4.9.59.p
73
+	 */
74
+	private function setCaffeinated()
75
+	{
76
+		$this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true)
77
+			&& is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php');
78
+	}
79
+
80
+
81
+	/**
82
+	 * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces
83
+	 * to allow for filtering the brand.
84
+	 *
85
+	 * @return string
86
+	 */
87
+	public static function brandName()
88
+	{
89
+		return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso');
90
+	}
91
+
92
+
93
+	/**
94
+	 * @return bool
95
+	 * @since 5.0.0.p
96
+	 */
97
+	public function isMultiSite(): bool
98
+	{
99
+		return $this->multisite;
100
+	}
101 101
 }
Please login to merge, or discard this patch.
admin/new/pricing/help_tabs/pricing_add_new_price_type.help_tab.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 <p><strong><?php esc_html_e('Add New Price Type', 'event_espresso'); ?></strong></p>
5 5
 <p>
6 6
 <?php printf(
7
-    esc_html__('This page allows you to create a new price type for %s.', 'event_espresso'),
8
-    Domain::brandName()
7
+	esc_html__('This page allows you to create a new price type for %s.', 'event_espresso'),
8
+	Domain::brandName()
9 9
 ); ?>
10 10
 </p>
11 11
 <ul>
Please login to merge, or discard this patch.
admin/new/pricing/help_tabs/pricing_edit_default_price.help_tab.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 <p><strong><?php esc_html_e('Edit Default Price', 'event_espresso'); ?></strong></p>
5 5
 <p>
6 6
 <?php printf(
7
-    esc_html__('This page allows you to edit a default price for %s.', 'event_espresso'),
8
-    Domain::brandName()
7
+	esc_html__('This page allows you to edit a default price for %s.', 'event_espresso'),
8
+	Domain::brandName()
9 9
 ); ?>
10 10
 </p>
11 11
 <ul>
Please login to merge, or discard this patch.
admin/new/pricing/help_tabs/pricing_edit_price_type.help_tab.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 <p><strong><?php esc_html_e('Edit Price Type', 'event_espresso'); ?></strong></p>
5 5
 <p>
6 6
 <?php printf(
7
-    esc_html__('This page allows you to edit a price type for %s.', 'event_espresso'),
8
-    Domain::brandName()
7
+	esc_html__('This page allows you to edit a price type for %s.', 'event_espresso'),
8
+	Domain::brandName()
9 9
 ); ?>
10 10
 </p>
11 11
 <ul>
Please login to merge, or discard this patch.
admin/new/pricing/help_tabs/pricing_add_new_default_price.help_tab.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 <p><strong><?php esc_html_e('Add New Default Price', 'event_espresso'); ?></strong></p>
5 5
 <p>
6 6
 <?php printf(
7
-    esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'),
8
-    Domain::brandName()
7
+	esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'),
8
+	Domain::brandName()
9 9
 ); ?>
10 10
 </p>
11 11
 <ul>
Please login to merge, or discard this patch.
core/domain/services/admin/ajax/WordpressHeartbeat.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
             $this->loader->getShared(
60 60
                 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'
61 61
             );
62
-        } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) {
62
+        } elseif ($screenID === 'front' && ! empty($heartbeat_data[self::RESPONSE_KEY_THANK_YOU_PAGE])) {
63 63
             $this->loader->getShared(
64 64
                 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor'
65 65
             );
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -16,52 +16,52 @@
 block discarded – undo
16 16
  */
17 17
 class WordpressHeartbeat
18 18
 {
19
-    const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page';
19
+	const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page';
20 20
 
21
-    /**
22
-     * @var LoaderInterface $loader
23
-     */
24
-    protected $loader;
21
+	/**
22
+	 * @var LoaderInterface $loader
23
+	 */
24
+	protected $loader;
25 25
 
26
-    /**
27
-     * @var RequestInterface $request
28
-     */
29
-    protected $request;
26
+	/**
27
+	 * @var RequestInterface $request
28
+	 */
29
+	protected $request;
30 30
 
31 31
 
32
-    /**
33
-     * WordpressHeartbeat constructor.
34
-     *
35
-     * @param LoaderInterface  $loader
36
-     * @param RequestInterface $request
37
-     */
38
-    public function __construct(
39
-        LoaderInterface $loader,
40
-        RequestInterface $request
41
-    ) {
42
-        $this->loader = $loader;
43
-        $this->request = $request;
44
-        do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this);
45
-        add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes'));
46
-    }
32
+	/**
33
+	 * WordpressHeartbeat constructor.
34
+	 *
35
+	 * @param LoaderInterface  $loader
36
+	 * @param RequestInterface $request
37
+	 */
38
+	public function __construct(
39
+		LoaderInterface $loader,
40
+		RequestInterface $request
41
+	) {
42
+		$this->loader = $loader;
43
+		$this->request = $request;
44
+		do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this);
45
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes'));
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * @since 4.9.76.p
51
-     * @throws InvalidClassException
52
-     */
53
-    public function resolveRoutes()
54
-    {
55
-        $screenID = $this->request->getRequestParam('screen_id');
56
-        $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true);
57
-        if ($screenID === 'espresso_events') {
58
-            $this->loader->getShared(
59
-                'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'
60
-            );
61
-        } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) {
62
-            $this->loader->getShared(
63
-                'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor'
64
-            );
65
-        }
66
-    }
49
+	/**
50
+	 * @since 4.9.76.p
51
+	 * @throws InvalidClassException
52
+	 */
53
+	public function resolveRoutes()
54
+	{
55
+		$screenID = $this->request->getRequestParam('screen_id');
56
+		$heartbeat_data = $this->request->getRequestParam('data', [], 'string', true);
57
+		if ($screenID === 'espresso_events') {
58
+			$this->loader->getShared(
59
+				'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'
60
+			);
61
+		} elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) {
62
+			$this->loader->getShared(
63
+				'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor'
64
+			);
65
+		}
66
+	}
67 67
 }
Please login to merge, or discard this patch.
core/third-party-compatibility.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * ACF compatibility
8 8
  */
9 9
 add_action(
10
-    'plugins_loaded',
11
-    function () {
12
-        if (function_exists('acf_include')) {
13
-            add_filter(
14
-                'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
17
-                        $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
-                        $ee_post_types = array_keys($ee_post_types);
19
-                        $post_types = array_merge($post_types, $ee_post_types);
20
-                        $post_types = array_unique($post_types);
21
-                    }
22
-                    return $post_types;
23
-                },
24
-                10,
25
-                2
26
-            );
27
-        }
28
-    },
29
-    100
10
+	'plugins_loaded',
11
+	function () {
12
+		if (function_exists('acf_include')) {
13
+			add_filter(
14
+				'acf/get_post_types',
15
+				function ($post_types, $args) {
16
+					if (! empty($args['show_ui'])) {
17
+						$ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
+						$ee_post_types = array_keys($ee_post_types);
19
+						$post_types = array_merge($post_types, $ee_post_types);
20
+						$post_types = array_unique($post_types);
21
+					}
22
+					return $post_types;
23
+				},
24
+				10,
25
+				2
26
+			);
27
+		}
28
+	},
29
+	100
30 30
 );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
  */
9 9
 add_action(
10 10
     'plugins_loaded',
11
-    function () {
11
+    function() {
12 12
         if (function_exists('acf_include')) {
13 13
             add_filter(
14 14
                 'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
15
+                function($post_types, $args) {
16
+                    if ( ! empty($args['show_ui'])) {
17 17
                         $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18 18
                         $ee_post_types = array_keys($ee_post_types);
19 19
                         $post_types = array_merge($post_types, $ee_post_types);
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_State_Select_Input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         if (isset($input_settings['value_field_name'])) {
38 38
             $this->valueFieldName = $input_settings['value_field_name'];
39
-            if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
39
+            if ( ! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40 40
                 throw new InvalidArgumentException(
41 41
                     sprintf(
42 42
                         esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             $this
54 54
         );
55 55
         $input_settings['html_class'] = isset($input_settings['html_class'])
56
-            ? $input_settings['html_class'] . ' ee-state-select-js'
56
+            ? $input_settings['html_class'].' ee-state-select-js'
57 57
             : 'ee-state-select-js';
58 58
         parent::__construct($state_options, $input_settings);
59 59
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function get_state_answer_options($state_options = null)
84 84
     {
85 85
         // if passed something that is NOT an array
86
-        if (! is_array($state_options) || empty($state_options)) {
86
+        if ( ! is_array($state_options) || empty($state_options)) {
87 87
             // get possibly cached list of states
88 88
             $states = EEM_State::instance()->get_all_active_states();
89 89
         }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
             $states = $state_options;
92 92
             $state_options = array();
93 93
         }
94
-        if (! empty($states)) {
94
+        if ( ! empty($states)) {
95 95
             // set the default
96 96
             $state_options[''][''] = '';
97 97
             foreach ($states as $state) {
98 98
                 if ($state instanceof EE_State) {
99
-                    $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
99
+                    $state_options[$state->country()->name()][$state->get($this->valueFieldName())] = $state->name();
100 100
                 }
101 101
             }
102 102
         }
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -12,94 +12,94 @@
 block discarded – undo
12 12
  */
13 13
 class EE_State_Select_Input extends EE_Select_Input
14 14
 {
15
-    /**
16
-     * @var string the name of the EE_State field to use for option values in the HTML form input.
17
-     */
18
-    protected $valueFieldName;
15
+	/**
16
+	 * @var string the name of the EE_State field to use for option values in the HTML form input.
17
+	 */
18
+	protected $valueFieldName;
19 19
 
20
-    /**
21
-     * @param EE_State[]|array|null $state_options. If a flat array of string is provided,
22
-     * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for
23
-     * the keys (which will become the option values). If null or empty is passed, all active states will be used,
24
-     * and $input_settings['value_field_name'] will again be used.     *
25
-     * @param array $input_settings same as parent, but also {
26
-     *   @type string $value_field_name the name of the field to use
27
-     *   for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`.
28
-     * }
29
-     * @throws EE_Error
30
-     * @throws InvalidArgumentException
31
-     * @throws InvalidDataTypeException
32
-     * @throws InvalidInterfaceException
33
-     * @throws ReflectionException
34
-     */
35
-    public function __construct($state_options, $input_settings = array())
36
-    {
37
-        if (isset($input_settings['value_field_name'])) {
38
-            $this->valueFieldName = $input_settings['value_field_name'];
39
-            if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40
-                throw new InvalidArgumentException(
41
-                    sprintf(
42
-                        esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
43
-                        $this->valueFieldName()
44
-                    )
45
-                );
46
-            }
47
-        } else {
48
-            $this->valueFieldName = 'STA_ID';
49
-        }
50
-        $state_options = apply_filters(
51
-            'FHEE__EE_State_Select_Input____construct__state_options',
52
-            $this->get_state_answer_options($state_options),
53
-            $this
54
-        );
55
-        $input_settings['html_class'] = isset($input_settings['html_class'])
56
-            ? $input_settings['html_class'] . ' ee-state-select-js'
57
-            : 'ee-state-select-js';
58
-        parent::__construct($state_options, $input_settings);
59
-    }
20
+	/**
21
+	 * @param EE_State[]|array|null $state_options. If a flat array of string is provided,
22
+	 * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for
23
+	 * the keys (which will become the option values). If null or empty is passed, all active states will be used,
24
+	 * and $input_settings['value_field_name'] will again be used.     *
25
+	 * @param array $input_settings same as parent, but also {
26
+	 *   @type string $value_field_name the name of the field to use
27
+	 *   for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`.
28
+	 * }
29
+	 * @throws EE_Error
30
+	 * @throws InvalidArgumentException
31
+	 * @throws InvalidDataTypeException
32
+	 * @throws InvalidInterfaceException
33
+	 * @throws ReflectionException
34
+	 */
35
+	public function __construct($state_options, $input_settings = array())
36
+	{
37
+		if (isset($input_settings['value_field_name'])) {
38
+			$this->valueFieldName = $input_settings['value_field_name'];
39
+			if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40
+				throw new InvalidArgumentException(
41
+					sprintf(
42
+						esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
43
+						$this->valueFieldName()
44
+					)
45
+				);
46
+			}
47
+		} else {
48
+			$this->valueFieldName = 'STA_ID';
49
+		}
50
+		$state_options = apply_filters(
51
+			'FHEE__EE_State_Select_Input____construct__state_options',
52
+			$this->get_state_answer_options($state_options),
53
+			$this
54
+		);
55
+		$input_settings['html_class'] = isset($input_settings['html_class'])
56
+			? $input_settings['html_class'] . ' ee-state-select-js'
57
+			: 'ee-state-select-js';
58
+		parent::__construct($state_options, $input_settings);
59
+	}
60 60
 
61
-    /**
62
-     * Returns the name of the state field used for the HTML option values.
63
-     * @since 4.10.0.p
64
-     * @return string
65
-     */
66
-    public function valueFieldName()
67
-    {
68
-        return $this->valueFieldName;
69
-    }
61
+	/**
62
+	 * Returns the name of the state field used for the HTML option values.
63
+	 * @since 4.10.0.p
64
+	 * @return string
65
+	 */
66
+	public function valueFieldName()
67
+	{
68
+		return $this->valueFieldName;
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * get_state_answer_options
74
-     *
75
-     * @param array $state_options
76
-     * @return array
77
-     * @throws EE_Error
78
-     * @throws InvalidArgumentException
79
-     * @throws ReflectionException
80
-     * @throws InvalidDataTypeException
81
-     * @throws InvalidInterfaceException
82
-     */
83
-    public function get_state_answer_options($state_options = null)
84
-    {
85
-        // if passed something that is NOT an array
86
-        if (! is_array($state_options) || empty($state_options)) {
87
-            // get possibly cached list of states
88
-            $states = EEM_State::instance()->get_all_active_states();
89
-        }
90
-        if (is_array($state_options) && reset($state_options) instanceof EE_State) {
91
-            $states = $state_options;
92
-            $state_options = array();
93
-        }
94
-        if (! empty($states)) {
95
-            // set the default
96
-            $state_options[''][''] = '';
97
-            foreach ($states as $state) {
98
-                if ($state instanceof EE_State) {
99
-                    $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
100
-                }
101
-            }
102
-        }
103
-        return $state_options;
104
-    }
72
+	/**
73
+	 * get_state_answer_options
74
+	 *
75
+	 * @param array $state_options
76
+	 * @return array
77
+	 * @throws EE_Error
78
+	 * @throws InvalidArgumentException
79
+	 * @throws ReflectionException
80
+	 * @throws InvalidDataTypeException
81
+	 * @throws InvalidInterfaceException
82
+	 */
83
+	public function get_state_answer_options($state_options = null)
84
+	{
85
+		// if passed something that is NOT an array
86
+		if (! is_array($state_options) || empty($state_options)) {
87
+			// get possibly cached list of states
88
+			$states = EEM_State::instance()->get_all_active_states();
89
+		}
90
+		if (is_array($state_options) && reset($state_options) instanceof EE_State) {
91
+			$states = $state_options;
92
+			$state_options = array();
93
+		}
94
+		if (! empty($states)) {
95
+			// set the default
96
+			$state_options[''][''] = '';
97
+			foreach ($states as $state) {
98
+				if ($state instanceof EE_State) {
99
+					$state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
100
+				}
101
+			}
102
+		}
103
+		return $state_options;
104
+	}
105 105
 }
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
     public function __construct()
24 24
     {
25 25
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26
-        if (! defined('REG_PG_SLUG')) {
26
+        if ( ! defined('REG_PG_SLUG')) {
27 27
             define('REG_PG_SLUG', 'espresso_registrations');
28 28
             define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG)));
29
-            define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/');
30
-            define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG));
31
-            define('REG_ASSETS_PATH', REG_ADMIN . 'assets/');
32
-            define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/');
33
-            define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/');
34
-            define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/');
29
+            define('REG_ADMIN', EE_ADMIN_PAGES.'registrations/');
30
+            define('REG_ADMIN_URL', admin_url('admin.php?page='.REG_PG_SLUG));
31
+            define('REG_ASSETS_PATH', REG_ADMIN.'assets/');
32
+            define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL.'registrations/assets/');
33
+            define('REG_TEMPLATE_PATH', REG_ADMIN.'templates/');
34
+            define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'registrations/templates/');
35 35
         }
36 36
 
37 37
         parent::__construct();
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
  */
12 12
 class Registrations_Admin_Page_Init extends EE_Admin_Page_CPT_Init
13 13
 {
14
-    /**
15
-     *        constructor
16
-     *
17
-     * @Constructor
18
-     * @access public
19
-     * @return void
20
-     */
21
-    public function __construct()
22
-    {
23
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
24
-        if (! defined('REG_PG_SLUG')) {
25
-            define('REG_PG_SLUG', 'espresso_registrations');
26
-            define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG)));
27
-            define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/');
28
-            define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG));
29
-            define('REG_ASSETS_PATH', REG_ADMIN . 'assets/');
30
-            define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/');
31
-            define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/');
32
-            define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/');
33
-        }
14
+	/**
15
+	 *        constructor
16
+	 *
17
+	 * @Constructor
18
+	 * @access public
19
+	 * @return void
20
+	 */
21
+	public function __construct()
22
+	{
23
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
24
+		if (! defined('REG_PG_SLUG')) {
25
+			define('REG_PG_SLUG', 'espresso_registrations');
26
+			define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG)));
27
+			define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/');
28
+			define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG));
29
+			define('REG_ASSETS_PATH', REG_ADMIN . 'assets/');
30
+			define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/');
31
+			define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/');
32
+			define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/');
33
+		}
34 34
 
35
-        parent::__construct();
36
-    }
35
+		parent::__construct();
36
+	}
37 37
 
38 38
 
39
-    protected function _set_init_properties()
40
-    {
41
-        $this->label = esc_html__('Registrations Overview', 'event_espresso');
42
-    }
39
+	protected function _set_init_properties()
40
+	{
41
+		$this->label = esc_html__('Registrations Overview', 'event_espresso');
42
+	}
43 43
 
44 44
 
45
-    public function getMenuProperties(): array
46
-    {
47
-        return [
48
-            'menu_type'       => AdminMenuItem::TYPE_MENU_SUB_ITEM,
49
-            'menu_group'      => 'main',
50
-            'menu_order'      => 40,
51
-            'show_on_menu'    => AdminMenuItem::DISPLAY_BLOG_ONLY,
52
-            'parent_slug'     => 'espresso_events',
53
-            'menu_slug'       => REG_PG_SLUG,
54
-            'menu_label'      => esc_html__('Registrations', 'event_espresso'),
55
-            'capability'      => 'ee_read_registrations',
56
-        ];
57
-    }
45
+	public function getMenuProperties(): array
46
+	{
47
+		return [
48
+			'menu_type'       => AdminMenuItem::TYPE_MENU_SUB_ITEM,
49
+			'menu_group'      => 'main',
50
+			'menu_order'      => 40,
51
+			'show_on_menu'    => AdminMenuItem::DISPLAY_BLOG_ONLY,
52
+			'parent_slug'     => 'espresso_events',
53
+			'menu_slug'       => REG_PG_SLUG,
54
+			'menu_label'      => esc_html__('Registrations', 'event_espresso'),
55
+			'capability'      => 'ee_read_registrations',
56
+		];
57
+	}
58 58
 }
Please login to merge, or discard this patch.