@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | if ($role instanceof WP_Role) { |
72 | 72 | foreach ($this->capabilities as $capability) { |
73 | 73 | // we're using the role name as the array index to prevent duplicates |
74 | - if (! isset($event_manager_roles[ $role->name ]) && $role->has_cap($capability)) { |
|
75 | - $event_manager_roles[ $role->name ] = $role; |
|
74 | + if ( ! isset($event_manager_roles[$role->name]) && $role->has_cap($capability)) { |
|
75 | + $event_manager_roles[$role->name] = $role; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->user_list = []; |
90 | 90 | } |
91 | 91 | // begin to build our query |
92 | - $SQL = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 " |
|
92 | + $SQL = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 " |
|
93 | 93 | . "INNER JOIN $wpdb->usermeta AS u2 ON u1.ID = u2.user_id " |
94 | 94 | . "AND u2.meta_key='{$wpdb->prefix}capabilities' " |
95 | 95 | . 'WHERE'; |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | foreach ($this->roles as $role) { |
98 | 98 | // for each role, add a WHERE clause |
99 | 99 | if ($role instanceof WP_Role) { |
100 | - $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $role->name . '"%\' '; |
|
100 | + $SQL .= $operator.' u2.meta_value LIKE \'%"'.$role->name.'"%\' '; |
|
101 | 101 | // subsequent clauses will use OR so that any role is accepted |
102 | 102 | $operator = 'OR'; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | foreach ($this->capabilities as $capability) { |
106 | 106 | // for each capability, add a WHERE clause |
107 | - $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $capability . '";b:1;%\' '; |
|
107 | + $SQL .= $operator.' u2.meta_value LIKE \'%"'.$capability.'";b:1;%\' '; |
|
108 | 108 | // subsequent clauses will use OR so that any role is accepted |
109 | 109 | $operator = 'OR'; |
110 | 110 | } |
111 | - $SQL .= 'ORDER BY user_id ASC'; |
|
111 | + $SQL .= 'ORDER BY user_id ASC'; |
|
112 | 112 | $users = $wpdb->get_results($SQL); |
113 | 113 | |
114 | 114 | $this->user_list = ! empty($users) ? $users : []; |
@@ -15,135 +15,135 @@ |
||
15 | 15 | */ |
16 | 16 | class EventManagers |
17 | 17 | { |
18 | - /** |
|
19 | - * @var string[] |
|
20 | - */ |
|
21 | - private $capabilities = []; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var WP_Role[] |
|
25 | - */ |
|
26 | - private $roles = []; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - private $user_list = []; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var WP_Role[] |
|
35 | - */ |
|
36 | - private $wp_roles; |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * EventManagerRoles constructor. |
|
41 | - */ |
|
42 | - public function __construct() |
|
43 | - { |
|
44 | - global $wp_roles; |
|
45 | - // first let's grab ALL of the WP_Role objects |
|
46 | - $this->wp_roles = $wp_roles->role_objects; |
|
47 | - $this->setCapabilities(); |
|
48 | - $this->buildRolesArray(); |
|
49 | - $this->buildUserList(); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - private function setCapabilities(): void |
|
54 | - { |
|
55 | - // filter a list of capabilities we want to use to define an event manager |
|
56 | - $capabilities = (array) apply_filters( |
|
57 | - 'FHEE__EventEspresso_core_domain_services_capabilities_EventManagers__setCapabilities', |
|
58 | - ['ee_edit_events', 'ee_edit_event'], |
|
59 | - $this->wp_roles |
|
60 | - ); |
|
61 | - $this->capabilities = array_map('sanitize_text_field', $capabilities); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - private function buildRolesArray(): void |
|
66 | - { |
|
67 | - // we'll use this array to capture all of the WP_Role objects that have any of the caps we are targeting |
|
68 | - $event_manager_roles = []; |
|
69 | - foreach ($this->wp_roles as $role) { |
|
70 | - if ($role instanceof WP_Role) { |
|
71 | - foreach ($this->capabilities as $capability) { |
|
72 | - // we're using the role name as the array index to prevent duplicates |
|
73 | - if (! isset($event_manager_roles[ $role->name ]) && $role->has_cap($capability)) { |
|
74 | - $event_manager_roles[ $role->name ] = $role; |
|
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - $this->roles = $event_manager_roles; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - private function buildUserList(): void |
|
84 | - { |
|
85 | - global $wpdb; |
|
86 | - // no roles ?!!? then nothing to query for |
|
87 | - if (empty($this->roles)) { |
|
88 | - $this->user_list = []; |
|
89 | - } |
|
90 | - // begin to build our query |
|
91 | - $SQL = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 " |
|
92 | - . "INNER JOIN $wpdb->usermeta AS u2 ON u1.ID = u2.user_id " |
|
93 | - . "AND u2.meta_key='{$wpdb->prefix}capabilities' " |
|
94 | - . 'WHERE'; |
|
95 | - $operator = ''; |
|
96 | - foreach ($this->roles as $role) { |
|
97 | - // for each role, add a WHERE clause |
|
98 | - if ($role instanceof WP_Role) { |
|
99 | - $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $role->name . '"%\' '; |
|
100 | - // subsequent clauses will use OR so that any role is accepted |
|
101 | - $operator = 'OR'; |
|
102 | - } |
|
103 | - } |
|
104 | - foreach ($this->capabilities as $capability) { |
|
105 | - // for each capability, add a WHERE clause |
|
106 | - $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $capability . '";b:1;%\' '; |
|
107 | - // subsequent clauses will use OR so that any role is accepted |
|
108 | - $operator = 'OR'; |
|
109 | - } |
|
110 | - $SQL .= 'ORDER BY user_id ASC'; |
|
111 | - $users = $wpdb->get_results($SQL); |
|
112 | - |
|
113 | - $this->user_list = ! empty($users) ? $users : []; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @return array |
|
119 | - */ |
|
120 | - public function capabilities(): array |
|
121 | - { |
|
122 | - return $this->capabilities; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Returns a list of WP_Role objects that have "event manager" capabilities |
|
128 | - * The list of "event manager" capabilities is filtered but defaults to: |
|
129 | - * - 'ee_edit_events' |
|
130 | - * - 'ee_edit_event' |
|
131 | - * |
|
132 | - * @return WP_Role[] |
|
133 | - */ |
|
134 | - public function roles(): array |
|
135 | - { |
|
136 | - return $this->roles; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - /** |
|
141 | - * Returns a list of users that have any of the Event Manager roles |
|
142 | - * |
|
143 | - * @return stdClass[] |
|
144 | - */ |
|
145 | - public function userList(): array |
|
146 | - { |
|
147 | - return $this->user_list; |
|
148 | - } |
|
18 | + /** |
|
19 | + * @var string[] |
|
20 | + */ |
|
21 | + private $capabilities = []; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var WP_Role[] |
|
25 | + */ |
|
26 | + private $roles = []; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + private $user_list = []; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var WP_Role[] |
|
35 | + */ |
|
36 | + private $wp_roles; |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * EventManagerRoles constructor. |
|
41 | + */ |
|
42 | + public function __construct() |
|
43 | + { |
|
44 | + global $wp_roles; |
|
45 | + // first let's grab ALL of the WP_Role objects |
|
46 | + $this->wp_roles = $wp_roles->role_objects; |
|
47 | + $this->setCapabilities(); |
|
48 | + $this->buildRolesArray(); |
|
49 | + $this->buildUserList(); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + private function setCapabilities(): void |
|
54 | + { |
|
55 | + // filter a list of capabilities we want to use to define an event manager |
|
56 | + $capabilities = (array) apply_filters( |
|
57 | + 'FHEE__EventEspresso_core_domain_services_capabilities_EventManagers__setCapabilities', |
|
58 | + ['ee_edit_events', 'ee_edit_event'], |
|
59 | + $this->wp_roles |
|
60 | + ); |
|
61 | + $this->capabilities = array_map('sanitize_text_field', $capabilities); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + private function buildRolesArray(): void |
|
66 | + { |
|
67 | + // we'll use this array to capture all of the WP_Role objects that have any of the caps we are targeting |
|
68 | + $event_manager_roles = []; |
|
69 | + foreach ($this->wp_roles as $role) { |
|
70 | + if ($role instanceof WP_Role) { |
|
71 | + foreach ($this->capabilities as $capability) { |
|
72 | + // we're using the role name as the array index to prevent duplicates |
|
73 | + if (! isset($event_manager_roles[ $role->name ]) && $role->has_cap($capability)) { |
|
74 | + $event_manager_roles[ $role->name ] = $role; |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + $this->roles = $event_manager_roles; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + private function buildUserList(): void |
|
84 | + { |
|
85 | + global $wpdb; |
|
86 | + // no roles ?!!? then nothing to query for |
|
87 | + if (empty($this->roles)) { |
|
88 | + $this->user_list = []; |
|
89 | + } |
|
90 | + // begin to build our query |
|
91 | + $SQL = "SELECT u1.ID, u1.display_name FROM $wpdb->users AS u1 " |
|
92 | + . "INNER JOIN $wpdb->usermeta AS u2 ON u1.ID = u2.user_id " |
|
93 | + . "AND u2.meta_key='{$wpdb->prefix}capabilities' " |
|
94 | + . 'WHERE'; |
|
95 | + $operator = ''; |
|
96 | + foreach ($this->roles as $role) { |
|
97 | + // for each role, add a WHERE clause |
|
98 | + if ($role instanceof WP_Role) { |
|
99 | + $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $role->name . '"%\' '; |
|
100 | + // subsequent clauses will use OR so that any role is accepted |
|
101 | + $operator = 'OR'; |
|
102 | + } |
|
103 | + } |
|
104 | + foreach ($this->capabilities as $capability) { |
|
105 | + // for each capability, add a WHERE clause |
|
106 | + $SQL .= $operator . ' u2.meta_value LIKE \'%"' . $capability . '";b:1;%\' '; |
|
107 | + // subsequent clauses will use OR so that any role is accepted |
|
108 | + $operator = 'OR'; |
|
109 | + } |
|
110 | + $SQL .= 'ORDER BY user_id ASC'; |
|
111 | + $users = $wpdb->get_results($SQL); |
|
112 | + |
|
113 | + $this->user_list = ! empty($users) ? $users : []; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @return array |
|
119 | + */ |
|
120 | + public function capabilities(): array |
|
121 | + { |
|
122 | + return $this->capabilities; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Returns a list of WP_Role objects that have "event manager" capabilities |
|
128 | + * The list of "event manager" capabilities is filtered but defaults to: |
|
129 | + * - 'ee_edit_events' |
|
130 | + * - 'ee_edit_event' |
|
131 | + * |
|
132 | + * @return WP_Role[] |
|
133 | + */ |
|
134 | + public function roles(): array |
|
135 | + { |
|
136 | + return $this->roles; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + /** |
|
141 | + * Returns a list of users that have any of the Event Manager roles |
|
142 | + * |
|
143 | + * @return stdClass[] |
|
144 | + */ |
|
145 | + public function userList(): array |
|
146 | + { |
|
147 | + return $this->user_list; |
|
148 | + } |
|
149 | 149 | } |
@@ -79,10 +79,10 @@ |
||
79 | 79 | $model_names = []; |
80 | 80 | if (is_array($this->_model_name_pointed_to)) { |
81 | 81 | foreach ($this->_model_name_pointed_to as $model_name) { |
82 | - $model_names[] = "EE_" . $model_name; |
|
82 | + $model_names[] = "EE_".$model_name; |
|
83 | 83 | } |
84 | 84 | } else { |
85 | - $model_names = ["EE_" . $this->_model_name_pointed_to]; |
|
85 | + $model_names = ["EE_".$this->_model_name_pointed_to]; |
|
86 | 86 | } |
87 | 87 | return $model_names; |
88 | 88 | } |
@@ -10,95 +10,95 @@ |
||
10 | 10 | */ |
11 | 11 | abstract class EE_Field_With_Model_Name extends EE_Model_Field_Base |
12 | 12 | { |
13 | - /** |
|
14 | - * Usually the name of a single model. However, as in the case for custom post types, |
|
15 | - * it can actually be an array of models |
|
16 | - * |
|
17 | - * @var string[] |
|
18 | - */ |
|
19 | - protected $_model_name_pointed_to; |
|
13 | + /** |
|
14 | + * Usually the name of a single model. However, as in the case for custom post types, |
|
15 | + * it can actually be an array of models |
|
16 | + * |
|
17 | + * @var string[] |
|
18 | + */ |
|
19 | + protected $_model_name_pointed_to; |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @param string $table_column name of column for field |
|
24 | - * @param string $nicename should be internationalized with __('blah','event_espresso') |
|
25 | - * @param boolean $nullable |
|
26 | - * @param int|string $default_value data type should match field type |
|
27 | - * @param string|string[] $model_name eg 'Event','Answer','Term', etc. |
|
28 | - * Basically its the model class's name without the "EEM_" |
|
29 | - */ |
|
30 | - public function __construct($table_column, $nicename, $nullable, $default_value, $model_name) |
|
31 | - { |
|
32 | - $this->_model_name_pointed_to = (array) $model_name; |
|
33 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
34 | - $this->setSchemaType(SchemaType::STRING); |
|
35 | - } |
|
22 | + /** |
|
23 | + * @param string $table_column name of column for field |
|
24 | + * @param string $nicename should be internationalized with __('blah','event_espresso') |
|
25 | + * @param boolean $nullable |
|
26 | + * @param int|string $default_value data type should match field type |
|
27 | + * @param string|string[] $model_name eg 'Event','Answer','Term', etc. |
|
28 | + * Basically its the model class's name without the "EEM_" |
|
29 | + */ |
|
30 | + public function __construct($table_column, $nicename, $nullable, $default_value, $model_name) |
|
31 | + { |
|
32 | + $this->_model_name_pointed_to = (array) $model_name; |
|
33 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
34 | + $this->setSchemaType(SchemaType::STRING); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * Returns the name of the model(s) pointed to |
|
40 | - * |
|
41 | - * @return string[] string or array of strings |
|
42 | - * @deprecated since version 4.6.7 |
|
43 | - */ |
|
44 | - public function get_model_name_pointed_to(): array |
|
45 | - { |
|
46 | - EE_Error::doing_it_wrong( |
|
47 | - 'get_model_name_pointed_to', |
|
48 | - esc_html__( |
|
49 | - 'This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', |
|
50 | - 'event_espresso' |
|
51 | - ), |
|
52 | - '4.6.7' |
|
53 | - ); |
|
54 | - return $this->_model_name_pointed_to; |
|
55 | - } |
|
38 | + /** |
|
39 | + * Returns the name of the model(s) pointed to |
|
40 | + * |
|
41 | + * @return string[] string or array of strings |
|
42 | + * @deprecated since version 4.6.7 |
|
43 | + */ |
|
44 | + public function get_model_name_pointed_to(): array |
|
45 | + { |
|
46 | + EE_Error::doing_it_wrong( |
|
47 | + 'get_model_name_pointed_to', |
|
48 | + esc_html__( |
|
49 | + 'This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', |
|
50 | + 'event_espresso' |
|
51 | + ), |
|
52 | + '4.6.7' |
|
53 | + ); |
|
54 | + return $this->_model_name_pointed_to; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * Gets the model names pointed to by this field, always as an array |
|
60 | - * (even if there's only one) |
|
61 | - * |
|
62 | - * @return string[] of model names pointed to by this field |
|
63 | - */ |
|
64 | - public function get_model_names_pointed_to(): array |
|
65 | - { |
|
66 | - return is_array($this->_model_name_pointed_to) |
|
67 | - ? $this->_model_name_pointed_to |
|
68 | - : [$this->_model_name_pointed_to]; |
|
69 | - } |
|
58 | + /** |
|
59 | + * Gets the model names pointed to by this field, always as an array |
|
60 | + * (even if there's only one) |
|
61 | + * |
|
62 | + * @return string[] of model names pointed to by this field |
|
63 | + */ |
|
64 | + public function get_model_names_pointed_to(): array |
|
65 | + { |
|
66 | + return is_array($this->_model_name_pointed_to) |
|
67 | + ? $this->_model_name_pointed_to |
|
68 | + : [$this->_model_name_pointed_to]; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * Returns the model's classname (eg EE_Event instead of just Event) |
|
74 | - * |
|
75 | - * @return string[] |
|
76 | - */ |
|
77 | - public function get_model_class_names_pointed_to(): array |
|
78 | - { |
|
79 | - $model_names = []; |
|
80 | - if (is_array($this->_model_name_pointed_to)) { |
|
81 | - foreach ($this->_model_name_pointed_to as $model_name) { |
|
82 | - $model_names[] = "EE_" . $model_name; |
|
83 | - } |
|
84 | - } else { |
|
85 | - $model_names = ["EE_" . $this->_model_name_pointed_to]; |
|
86 | - } |
|
87 | - return $model_names; |
|
88 | - } |
|
72 | + /** |
|
73 | + * Returns the model's classname (eg EE_Event instead of just Event) |
|
74 | + * |
|
75 | + * @return string[] |
|
76 | + */ |
|
77 | + public function get_model_class_names_pointed_to(): array |
|
78 | + { |
|
79 | + $model_names = []; |
|
80 | + if (is_array($this->_model_name_pointed_to)) { |
|
81 | + foreach ($this->_model_name_pointed_to as $model_name) { |
|
82 | + $model_names[] = "EE_" . $model_name; |
|
83 | + } |
|
84 | + } else { |
|
85 | + $model_names = ["EE_" . $this->_model_name_pointed_to]; |
|
86 | + } |
|
87 | + return $model_names; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * @param int|EE_Base_Class $model_obj |
|
93 | - * @return bool |
|
94 | - */ |
|
95 | - public function is_model_obj_of_type_pointed_to($model_obj): bool |
|
96 | - { |
|
97 | - foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) { |
|
98 | - if ($model_obj instanceof $model_obj_classname) { |
|
99 | - return true; |
|
100 | - } |
|
101 | - } |
|
102 | - return false; |
|
103 | - } |
|
91 | + /** |
|
92 | + * @param int|EE_Base_Class $model_obj |
|
93 | + * @return bool |
|
94 | + */ |
|
95 | + public function is_model_obj_of_type_pointed_to($model_obj): bool |
|
96 | + { |
|
97 | + foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) { |
|
98 | + if ($model_obj instanceof $model_obj_classname) { |
|
99 | + return true; |
|
100 | + } |
|
101 | + } |
|
102 | + return false; |
|
103 | + } |
|
104 | 104 | } |
@@ -5,12 +5,12 @@ |
||
5 | 5 | */ |
6 | 6 | class EE_WP_Post_Type_Field extends EE_DB_Only_Text_Field |
7 | 7 | { |
8 | - /** |
|
9 | - * @param string $post_type the exact string to be used for the post type |
|
10 | - * of all these post type model objects/rows |
|
11 | - */ |
|
12 | - public function __construct($post_type) |
|
13 | - { |
|
14 | - parent::__construct('post_type', esc_html__("Post Type", 'event_espresso'), false, $post_type); |
|
15 | - } |
|
8 | + /** |
|
9 | + * @param string $post_type the exact string to be used for the post type |
|
10 | + * of all these post type model objects/rows |
|
11 | + */ |
|
12 | + public function __construct($post_type) |
|
13 | + { |
|
14 | + parent::__construct('post_type', esc_html__("Post Type", 'event_espresso'), false, $post_type); |
|
15 | + } |
|
16 | 16 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | ), |
71 | 71 | ], |
72 | 72 | ]; |
73 | - $this->_model_relations = [ |
|
73 | + $this->_model_relations = [ |
|
74 | 74 | 'Registration' => new EE_Belongs_To_Relation(), |
75 | 75 | 'Datetime' => new EE_Belongs_To_Relation(), |
76 | 76 | ]; |
@@ -10,67 +10,67 @@ |
||
10 | 10 | */ |
11 | 11 | class EEM_Checkin extends EEM_Base |
12 | 12 | { |
13 | - protected static ?EEM_Checkin $_instance = null; |
|
13 | + protected static ?EEM_Checkin $_instance = null; |
|
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * private constructor to prevent direct creation |
|
18 | - * |
|
19 | - * @param string|null $timezone string representing the timezone we want to set for returned Date Time Strings |
|
20 | - * (and any incoming timezone data that gets saved). |
|
21 | - * Note this just sends the timezone info to the date time model field objects. |
|
22 | - * Default is NULL |
|
23 | - * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
24 | - * @throws EE_Error |
|
25 | - */ |
|
26 | - protected function __construct(?string $timezone = '') |
|
27 | - { |
|
28 | - $this->singular_item = esc_html__('Check-In', 'event_espresso'); |
|
29 | - $this->plural_item = esc_html__('Check-Ins', 'event_espresso'); |
|
16 | + /** |
|
17 | + * private constructor to prevent direct creation |
|
18 | + * |
|
19 | + * @param string|null $timezone string representing the timezone we want to set for returned Date Time Strings |
|
20 | + * (and any incoming timezone data that gets saved). |
|
21 | + * Note this just sends the timezone info to the date time model field objects. |
|
22 | + * Default is NULL |
|
23 | + * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
24 | + * @throws EE_Error |
|
25 | + */ |
|
26 | + protected function __construct(?string $timezone = '') |
|
27 | + { |
|
28 | + $this->singular_item = esc_html__('Check-In', 'event_espresso'); |
|
29 | + $this->plural_item = esc_html__('Check-Ins', 'event_espresso'); |
|
30 | 30 | |
31 | - $this->_tables = [ |
|
32 | - 'Checkin' => new EE_Primary_Table('esp_checkin', 'CHK_ID'), |
|
33 | - ]; |
|
34 | - $this->_fields = [ |
|
35 | - 'Checkin' => [ |
|
36 | - 'CHK_ID' => new EE_Primary_Key_Int_Field( |
|
37 | - 'CHK_ID', |
|
38 | - esc_html__('Check-in ID', 'event_espresso') |
|
39 | - ), |
|
40 | - 'REG_ID' => new EE_Foreign_Key_Int_Field( |
|
41 | - 'REG_ID', |
|
42 | - esc_html__('Registration Id', 'event_espresso'), |
|
43 | - false, |
|
44 | - 0, |
|
45 | - 'Registration' |
|
46 | - ), |
|
47 | - 'DTT_ID' => new EE_Foreign_Key_Int_Field( |
|
48 | - 'DTT_ID', |
|
49 | - esc_html__('Datetime Id', 'event_espresso'), |
|
50 | - false, |
|
51 | - 0, |
|
52 | - 'Datetime' |
|
53 | - ), |
|
54 | - 'CHK_in' => new EE_Boolean_Field( |
|
55 | - 'CHK_in', |
|
56 | - esc_html__('Whether a person has checked in or checked out', 'event_espresso'), |
|
57 | - false, |
|
58 | - true |
|
59 | - ), |
|
60 | - 'CHK_timestamp' => new EE_Datetime_Field( |
|
61 | - 'CHK_timestamp', |
|
62 | - esc_html__('When the row was modified', 'event_espresso'), |
|
63 | - false, |
|
64 | - EE_Datetime_Field::now, |
|
65 | - $timezone |
|
66 | - ), |
|
67 | - ], |
|
68 | - ]; |
|
69 | - $this->_model_relations = [ |
|
70 | - 'Registration' => new EE_Belongs_To_Relation(), |
|
71 | - 'Datetime' => new EE_Belongs_To_Relation(), |
|
72 | - ]; |
|
73 | - $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
74 | - parent::__construct($timezone); |
|
75 | - } |
|
31 | + $this->_tables = [ |
|
32 | + 'Checkin' => new EE_Primary_Table('esp_checkin', 'CHK_ID'), |
|
33 | + ]; |
|
34 | + $this->_fields = [ |
|
35 | + 'Checkin' => [ |
|
36 | + 'CHK_ID' => new EE_Primary_Key_Int_Field( |
|
37 | + 'CHK_ID', |
|
38 | + esc_html__('Check-in ID', 'event_espresso') |
|
39 | + ), |
|
40 | + 'REG_ID' => new EE_Foreign_Key_Int_Field( |
|
41 | + 'REG_ID', |
|
42 | + esc_html__('Registration Id', 'event_espresso'), |
|
43 | + false, |
|
44 | + 0, |
|
45 | + 'Registration' |
|
46 | + ), |
|
47 | + 'DTT_ID' => new EE_Foreign_Key_Int_Field( |
|
48 | + 'DTT_ID', |
|
49 | + esc_html__('Datetime Id', 'event_espresso'), |
|
50 | + false, |
|
51 | + 0, |
|
52 | + 'Datetime' |
|
53 | + ), |
|
54 | + 'CHK_in' => new EE_Boolean_Field( |
|
55 | + 'CHK_in', |
|
56 | + esc_html__('Whether a person has checked in or checked out', 'event_espresso'), |
|
57 | + false, |
|
58 | + true |
|
59 | + ), |
|
60 | + 'CHK_timestamp' => new EE_Datetime_Field( |
|
61 | + 'CHK_timestamp', |
|
62 | + esc_html__('When the row was modified', 'event_espresso'), |
|
63 | + false, |
|
64 | + EE_Datetime_Field::now, |
|
65 | + $timezone |
|
66 | + ), |
|
67 | + ], |
|
68 | + ]; |
|
69 | + $this->_model_relations = [ |
|
70 | + 'Registration' => new EE_Belongs_To_Relation(), |
|
71 | + 'Datetime' => new EE_Belongs_To_Relation(), |
|
72 | + ]; |
|
73 | + $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
74 | + parent::__construct($timezone); |
|
75 | + } |
|
76 | 76 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | 'Payment_Method' => new EE_Belongs_To_Relation(), |
56 | 56 | ]; |
57 | 57 | // this model is generally available for reading |
58 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
58 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
59 | 59 | $this->_caps_slug = 'payment_methods'; |
60 | 60 | parent::__construct($timezone); |
61 | 61 | } |
@@ -9,49 +9,49 @@ |
||
9 | 9 | */ |
10 | 10 | class EEM_Currency_Payment_Method extends EEM_Base |
11 | 11 | { |
12 | - protected static ?EEM_Currency_Payment_Method $_instance = null; |
|
12 | + protected static ?EEM_Currency_Payment_Method $_instance = null; |
|
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * @param string|null $timezone |
|
17 | - * @throws EE_Error |
|
18 | - */ |
|
19 | - protected function __construct(?string $timezone = '') |
|
20 | - { |
|
21 | - $this->singular_item = esc_html__('Currency Usable by Payment Method', 'event_espresso'); |
|
22 | - $this->plural_item = esc_html__('Currencies Usable by Payment Methods', 'event_espresso'); |
|
23 | - $this->_tables = [ |
|
24 | - 'Currency_Payment_Method' => new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID'), |
|
25 | - ]; |
|
26 | - $this->_fields = [ |
|
27 | - 'Currency_Payment_Method' => [ |
|
28 | - 'CPM_ID' => new EE_Primary_Key_Int_Field( |
|
29 | - 'CPM_ID', |
|
30 | - esc_html__('Currency to Payment Method LInk ID', 'event_espresso') |
|
31 | - ), |
|
32 | - 'CUR_code' => new EE_Foreign_Key_String_Field( |
|
33 | - 'CUR_code', |
|
34 | - esc_html__('Currency Code', 'event_espresso'), |
|
35 | - false, |
|
36 | - '', |
|
37 | - 'Currency' |
|
38 | - ), |
|
39 | - 'PMD_ID' => new EE_Foreign_Key_Int_Field( |
|
40 | - 'PMD_ID', |
|
41 | - esc_html__('Paymetn Method ID', 'event_espresso'), |
|
42 | - false, |
|
43 | - 0, |
|
44 | - 'Payment_Method' |
|
45 | - ), |
|
46 | - ], |
|
47 | - ]; |
|
48 | - $this->_model_relations = [ |
|
49 | - 'Currency' => new EE_Belongs_To_Relation(), |
|
50 | - 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
51 | - ]; |
|
52 | - // this model is generally available for reading |
|
53 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
54 | - $this->_caps_slug = 'payment_methods'; |
|
55 | - parent::__construct($timezone); |
|
56 | - } |
|
15 | + /** |
|
16 | + * @param string|null $timezone |
|
17 | + * @throws EE_Error |
|
18 | + */ |
|
19 | + protected function __construct(?string $timezone = '') |
|
20 | + { |
|
21 | + $this->singular_item = esc_html__('Currency Usable by Payment Method', 'event_espresso'); |
|
22 | + $this->plural_item = esc_html__('Currencies Usable by Payment Methods', 'event_espresso'); |
|
23 | + $this->_tables = [ |
|
24 | + 'Currency_Payment_Method' => new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID'), |
|
25 | + ]; |
|
26 | + $this->_fields = [ |
|
27 | + 'Currency_Payment_Method' => [ |
|
28 | + 'CPM_ID' => new EE_Primary_Key_Int_Field( |
|
29 | + 'CPM_ID', |
|
30 | + esc_html__('Currency to Payment Method LInk ID', 'event_espresso') |
|
31 | + ), |
|
32 | + 'CUR_code' => new EE_Foreign_Key_String_Field( |
|
33 | + 'CUR_code', |
|
34 | + esc_html__('Currency Code', 'event_espresso'), |
|
35 | + false, |
|
36 | + '', |
|
37 | + 'Currency' |
|
38 | + ), |
|
39 | + 'PMD_ID' => new EE_Foreign_Key_Int_Field( |
|
40 | + 'PMD_ID', |
|
41 | + esc_html__('Paymetn Method ID', 'event_espresso'), |
|
42 | + false, |
|
43 | + 0, |
|
44 | + 'Payment_Method' |
|
45 | + ), |
|
46 | + ], |
|
47 | + ]; |
|
48 | + $this->_model_relations = [ |
|
49 | + 'Currency' => new EE_Belongs_To_Relation(), |
|
50 | + 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
51 | + ]; |
|
52 | + // this model is generally available for reading |
|
53 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
54 | + $this->_caps_slug = 'payment_methods'; |
|
55 | + parent::__construct($timezone); |
|
56 | + } |
|
57 | 57 | } |
@@ -4,49 +4,49 @@ |
||
4 | 4 | |
5 | 5 | class Button |
6 | 6 | { |
7 | - /** |
|
8 | - * indicates that the HTML input type is 'button' |
|
9 | - */ |
|
10 | - public const TYPE_BUTTON = 'button'; |
|
11 | - |
|
12 | - /** |
|
13 | - * indicates that the HTML input type is 'reset' |
|
14 | - */ |
|
15 | - public const TYPE_BUTTON_RESET = 'reset'; |
|
16 | - |
|
17 | - /** |
|
18 | - * indicates that the HTML input type is 'submit' |
|
19 | - */ |
|
20 | - public const TYPE_BUTTON_SUBMIT = 'submit'; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - private $valid_type_options; |
|
27 | - |
|
28 | - |
|
29 | - public function __construct() |
|
30 | - { |
|
31 | - $this->valid_type_options = apply_filters( |
|
32 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_Button__valid_type_options', |
|
33 | - [ |
|
34 | - Button::TYPE_BUTTON => esc_html__('Button', 'event_espresso'), |
|
35 | - Button::TYPE_BUTTON_RESET => esc_html__('Reset Button', 'event_espresso'), |
|
36 | - Button::TYPE_BUTTON_SUBMIT => esc_html__('Submit Button', 'event_espresso'), |
|
37 | - ] |
|
38 | - ); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @param bool $constants_only |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - public function validTypeOptions(bool $constants_only = false): array |
|
47 | - { |
|
48 | - return $constants_only |
|
49 | - ? array_keys($this->valid_type_options) |
|
50 | - : $this->valid_type_options; |
|
51 | - } |
|
7 | + /** |
|
8 | + * indicates that the HTML input type is 'button' |
|
9 | + */ |
|
10 | + public const TYPE_BUTTON = 'button'; |
|
11 | + |
|
12 | + /** |
|
13 | + * indicates that the HTML input type is 'reset' |
|
14 | + */ |
|
15 | + public const TYPE_BUTTON_RESET = 'reset'; |
|
16 | + |
|
17 | + /** |
|
18 | + * indicates that the HTML input type is 'submit' |
|
19 | + */ |
|
20 | + public const TYPE_BUTTON_SUBMIT = 'submit'; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + private $valid_type_options; |
|
27 | + |
|
28 | + |
|
29 | + public function __construct() |
|
30 | + { |
|
31 | + $this->valid_type_options = apply_filters( |
|
32 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_Button__valid_type_options', |
|
33 | + [ |
|
34 | + Button::TYPE_BUTTON => esc_html__('Button', 'event_espresso'), |
|
35 | + Button::TYPE_BUTTON_RESET => esc_html__('Reset Button', 'event_espresso'), |
|
36 | + Button::TYPE_BUTTON_SUBMIT => esc_html__('Submit Button', 'event_espresso'), |
|
37 | + ] |
|
38 | + ); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @param bool $constants_only |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + public function validTypeOptions(bool $constants_only = false): array |
|
47 | + { |
|
48 | + return $constants_only |
|
49 | + ? array_keys($this->valid_type_options) |
|
50 | + : $this->valid_type_options; |
|
51 | + } |
|
52 | 52 | } |
@@ -5,81 +5,81 @@ |
||
5 | 5 | class DateTime |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * indicates that the HTML input type is 'date' |
|
10 | - */ |
|
11 | - public const TYPE_DATE = 'date'; |
|
12 | - |
|
13 | - /** |
|
14 | - * indicates that the HTML input type is 'datetime-local' |
|
15 | - */ |
|
16 | - public const TYPE_DATETIME_LOCAL = 'datetime-local'; |
|
17 | - |
|
18 | - /** |
|
19 | - * indicates that the HTML input type is 'month' |
|
20 | - */ |
|
21 | - public const TYPE_MONTH = 'month'; |
|
22 | - |
|
23 | - /** |
|
24 | - * indicates that the HTML input type is 'time' |
|
25 | - */ |
|
26 | - public const TYPE_TIME = 'time'; |
|
27 | - |
|
28 | - /** |
|
29 | - * indicates that the HTML input type is 'week' |
|
30 | - */ |
|
31 | - public const TYPE_WEEK = 'week'; |
|
32 | - |
|
33 | - // CUSTOM EE DATE TYPES |
|
34 | - |
|
35 | - /** |
|
36 | - * indicates that the input is an HTML dropdown used for selecting the day for a date |
|
37 | - */ |
|
38 | - public const TYPE_SELECT_DAY = 'day-select'; |
|
39 | - |
|
40 | - /** |
|
41 | - * indicates that the input is an HTML dropdown used for selecting the month for a date |
|
42 | - */ |
|
43 | - public const TYPE_SELECT_MONTH = 'month-select'; |
|
44 | - |
|
45 | - /** |
|
46 | - * indicates that the input is an HTML dropdown used for selecting the year for a date |
|
47 | - */ |
|
48 | - public const TYPE_SELECT_YEAR = 'year-select'; |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * @var array |
|
53 | - */ |
|
54 | - private $valid_type_options; |
|
55 | - |
|
56 | - |
|
57 | - public function __construct() |
|
58 | - { |
|
59 | - $this->valid_type_options = apply_filters( |
|
60 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_DateTime__valid_type_options', |
|
61 | - [ |
|
62 | - DateTime::TYPE_DATE => esc_html__('Date Picker', 'event_espresso'), |
|
63 | - DateTime::TYPE_DATETIME_LOCAL => esc_html__('Local Date Picker', 'event_espresso'), |
|
64 | - DateTime::TYPE_MONTH => esc_html__('Month Picker', 'event_espresso'), |
|
65 | - DateTime::TYPE_TIME => esc_html__('Time Picker', 'event_espresso'), |
|
66 | - DateTime::TYPE_WEEK => esc_html__('Week Picker', 'event_espresso'), |
|
67 | - DateTime::TYPE_SELECT_DAY => esc_html__('Day Selector', 'event_espresso'), |
|
68 | - DateTime::TYPE_SELECT_MONTH => esc_html__('Month Selector', 'event_espresso'), |
|
69 | - DateTime::TYPE_SELECT_YEAR => esc_html__('Year Selector', 'event_espresso'), |
|
70 | - ] |
|
71 | - ); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @param bool $constants_only |
|
77 | - * @return array |
|
78 | - */ |
|
79 | - public function validTypeOptions(bool $constants_only = false): array |
|
80 | - { |
|
81 | - return $constants_only |
|
82 | - ? array_keys($this->valid_type_options) |
|
83 | - : $this->valid_type_options; |
|
84 | - } |
|
8 | + /** |
|
9 | + * indicates that the HTML input type is 'date' |
|
10 | + */ |
|
11 | + public const TYPE_DATE = 'date'; |
|
12 | + |
|
13 | + /** |
|
14 | + * indicates that the HTML input type is 'datetime-local' |
|
15 | + */ |
|
16 | + public const TYPE_DATETIME_LOCAL = 'datetime-local'; |
|
17 | + |
|
18 | + /** |
|
19 | + * indicates that the HTML input type is 'month' |
|
20 | + */ |
|
21 | + public const TYPE_MONTH = 'month'; |
|
22 | + |
|
23 | + /** |
|
24 | + * indicates that the HTML input type is 'time' |
|
25 | + */ |
|
26 | + public const TYPE_TIME = 'time'; |
|
27 | + |
|
28 | + /** |
|
29 | + * indicates that the HTML input type is 'week' |
|
30 | + */ |
|
31 | + public const TYPE_WEEK = 'week'; |
|
32 | + |
|
33 | + // CUSTOM EE DATE TYPES |
|
34 | + |
|
35 | + /** |
|
36 | + * indicates that the input is an HTML dropdown used for selecting the day for a date |
|
37 | + */ |
|
38 | + public const TYPE_SELECT_DAY = 'day-select'; |
|
39 | + |
|
40 | + /** |
|
41 | + * indicates that the input is an HTML dropdown used for selecting the month for a date |
|
42 | + */ |
|
43 | + public const TYPE_SELECT_MONTH = 'month-select'; |
|
44 | + |
|
45 | + /** |
|
46 | + * indicates that the input is an HTML dropdown used for selecting the year for a date |
|
47 | + */ |
|
48 | + public const TYPE_SELECT_YEAR = 'year-select'; |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * @var array |
|
53 | + */ |
|
54 | + private $valid_type_options; |
|
55 | + |
|
56 | + |
|
57 | + public function __construct() |
|
58 | + { |
|
59 | + $this->valid_type_options = apply_filters( |
|
60 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_DateTime__valid_type_options', |
|
61 | + [ |
|
62 | + DateTime::TYPE_DATE => esc_html__('Date Picker', 'event_espresso'), |
|
63 | + DateTime::TYPE_DATETIME_LOCAL => esc_html__('Local Date Picker', 'event_espresso'), |
|
64 | + DateTime::TYPE_MONTH => esc_html__('Month Picker', 'event_espresso'), |
|
65 | + DateTime::TYPE_TIME => esc_html__('Time Picker', 'event_espresso'), |
|
66 | + DateTime::TYPE_WEEK => esc_html__('Week Picker', 'event_espresso'), |
|
67 | + DateTime::TYPE_SELECT_DAY => esc_html__('Day Selector', 'event_espresso'), |
|
68 | + DateTime::TYPE_SELECT_MONTH => esc_html__('Month Selector', 'event_espresso'), |
|
69 | + DateTime::TYPE_SELECT_YEAR => esc_html__('Year Selector', 'event_espresso'), |
|
70 | + ] |
|
71 | + ); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @param bool $constants_only |
|
77 | + * @return array |
|
78 | + */ |
|
79 | + public function validTypeOptions(bool $constants_only = false): array |
|
80 | + { |
|
81 | + return $constants_only |
|
82 | + ? array_keys($this->valid_type_options) |
|
83 | + : $this->valid_type_options; |
|
84 | + } |
|
85 | 85 | } |
@@ -5,49 +5,49 @@ |
||
5 | 5 | class Number |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * indicates that the HTML input type is 'number' whose value is a decimal (float) |
|
10 | - */ |
|
11 | - public const TYPE_FLOAT = 'decimal'; |
|
12 | - |
|
13 | - /** |
|
14 | - * indicates that the HTML input type is 'number' whose value is an integer (whole number) |
|
15 | - */ |
|
16 | - public const TYPE_INT = 'integer'; |
|
17 | - |
|
18 | - /** |
|
19 | - * indicates that the HTML input type is 'range' |
|
20 | - */ |
|
21 | - public const TYPE_RANGE = 'range'; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @var array |
|
26 | - */ |
|
27 | - private $valid_type_options; |
|
28 | - |
|
29 | - |
|
30 | - public function __construct() |
|
31 | - { |
|
32 | - $this->valid_type_options = apply_filters( |
|
33 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_Number__valid_type_options', |
|
34 | - [ |
|
35 | - Number::TYPE_FLOAT => esc_html__('Decimal Number', 'event_espresso'), |
|
36 | - Number::TYPE_INT => esc_html__('Integer (Whole) Number', 'event_espresso'), |
|
37 | - Number::TYPE_RANGE => esc_html__('Number Range', 'event_espresso'), |
|
38 | - ] |
|
39 | - ); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @param bool $constants_only |
|
45 | - * @return array |
|
46 | - */ |
|
47 | - public function validTypeOptions(bool $constants_only = false): array |
|
48 | - { |
|
49 | - return $constants_only |
|
50 | - ? array_keys($this->valid_type_options) |
|
51 | - : $this->valid_type_options; |
|
52 | - } |
|
8 | + /** |
|
9 | + * indicates that the HTML input type is 'number' whose value is a decimal (float) |
|
10 | + */ |
|
11 | + public const TYPE_FLOAT = 'decimal'; |
|
12 | + |
|
13 | + /** |
|
14 | + * indicates that the HTML input type is 'number' whose value is an integer (whole number) |
|
15 | + */ |
|
16 | + public const TYPE_INT = 'integer'; |
|
17 | + |
|
18 | + /** |
|
19 | + * indicates that the HTML input type is 'range' |
|
20 | + */ |
|
21 | + public const TYPE_RANGE = 'range'; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @var array |
|
26 | + */ |
|
27 | + private $valid_type_options; |
|
28 | + |
|
29 | + |
|
30 | + public function __construct() |
|
31 | + { |
|
32 | + $this->valid_type_options = apply_filters( |
|
33 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_Number__valid_type_options', |
|
34 | + [ |
|
35 | + Number::TYPE_FLOAT => esc_html__('Decimal Number', 'event_espresso'), |
|
36 | + Number::TYPE_INT => esc_html__('Integer (Whole) Number', 'event_espresso'), |
|
37 | + Number::TYPE_RANGE => esc_html__('Number Range', 'event_espresso'), |
|
38 | + ] |
|
39 | + ); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @param bool $constants_only |
|
45 | + * @return array |
|
46 | + */ |
|
47 | + public function validTypeOptions(bool $constants_only = false): array |
|
48 | + { |
|
49 | + return $constants_only |
|
50 | + ? array_keys($this->valid_type_options) |
|
51 | + : $this->valid_type_options; |
|
52 | + } |
|
53 | 53 | } |
@@ -5,59 +5,59 @@ |
||
5 | 5 | class Select |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * indicates that the input is an HTML dropdown (select input) that accepts only one value |
|
10 | - */ |
|
11 | - public const TYPE_SELECT = 'select'; |
|
12 | - |
|
13 | - /** |
|
14 | - * indicates that the input is an HTML dropdown (select input) that accepts multiple values |
|
15 | - */ |
|
16 | - public const TYPE_SELECT_MULTI = 'select-multi'; |
|
17 | - |
|
18 | - // CUSTOM EE SELECT TYPES |
|
19 | - |
|
20 | - /** |
|
21 | - * indicates that input is an HTML dropdown (select input) |
|
22 | - * populated with names of countries that are enabled for the site |
|
23 | - */ |
|
24 | - public const TYPE_SELECT_COUNTRY = 'select-country'; |
|
25 | - |
|
26 | - /** |
|
27 | - * indicates that the input is an HTML dropdown (select input) |
|
28 | - * populated with names of states for the countries that are enabled for the site |
|
29 | - */ |
|
30 | - public const TYPE_SELECT_STATE = 'select-state'; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - private $valid_type_options; |
|
37 | - |
|
38 | - |
|
39 | - public function __construct() |
|
40 | - { |
|
41 | - $this->valid_type_options = apply_filters( |
|
42 | - 'FHEE__EventEspresso_core_services_form_meta_inputs_Select__valid_type_options', |
|
43 | - [ |
|
44 | - Select::TYPE_SELECT => esc_html__('Dropdown', 'event_espresso'), |
|
45 | - Select::TYPE_SELECT_MULTI => esc_html__('Multi-Select Dropdown', 'event_espresso'), |
|
46 | - Select::TYPE_SELECT_COUNTRY => esc_html__('Country Selector', 'event_espresso'), |
|
47 | - Select::TYPE_SELECT_STATE => esc_html__('State Selector', 'event_espresso'), |
|
48 | - ] |
|
49 | - ); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * @param bool $constants_only |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function validTypeOptions(bool $constants_only = false): array |
|
58 | - { |
|
59 | - return $constants_only |
|
60 | - ? array_keys($this->valid_type_options) |
|
61 | - : $this->valid_type_options; |
|
62 | - } |
|
8 | + /** |
|
9 | + * indicates that the input is an HTML dropdown (select input) that accepts only one value |
|
10 | + */ |
|
11 | + public const TYPE_SELECT = 'select'; |
|
12 | + |
|
13 | + /** |
|
14 | + * indicates that the input is an HTML dropdown (select input) that accepts multiple values |
|
15 | + */ |
|
16 | + public const TYPE_SELECT_MULTI = 'select-multi'; |
|
17 | + |
|
18 | + // CUSTOM EE SELECT TYPES |
|
19 | + |
|
20 | + /** |
|
21 | + * indicates that input is an HTML dropdown (select input) |
|
22 | + * populated with names of countries that are enabled for the site |
|
23 | + */ |
|
24 | + public const TYPE_SELECT_COUNTRY = 'select-country'; |
|
25 | + |
|
26 | + /** |
|
27 | + * indicates that the input is an HTML dropdown (select input) |
|
28 | + * populated with names of states for the countries that are enabled for the site |
|
29 | + */ |
|
30 | + public const TYPE_SELECT_STATE = 'select-state'; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + private $valid_type_options; |
|
37 | + |
|
38 | + |
|
39 | + public function __construct() |
|
40 | + { |
|
41 | + $this->valid_type_options = apply_filters( |
|
42 | + 'FHEE__EventEspresso_core_services_form_meta_inputs_Select__valid_type_options', |
|
43 | + [ |
|
44 | + Select::TYPE_SELECT => esc_html__('Dropdown', 'event_espresso'), |
|
45 | + Select::TYPE_SELECT_MULTI => esc_html__('Multi-Select Dropdown', 'event_espresso'), |
|
46 | + Select::TYPE_SELECT_COUNTRY => esc_html__('Country Selector', 'event_espresso'), |
|
47 | + Select::TYPE_SELECT_STATE => esc_html__('State Selector', 'event_espresso'), |
|
48 | + ] |
|
49 | + ); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * @param bool $constants_only |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function validTypeOptions(bool $constants_only = false): array |
|
58 | + { |
|
59 | + return $constants_only |
|
60 | + ? array_keys($this->valid_type_options) |
|
61 | + : $this->valid_type_options; |
|
62 | + } |
|
63 | 63 | } |