@@ -191,7 +191,7 @@ |
||
191 | 191 | 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
192 | 192 | ); |
193 | 193 | // this model is generally available for reading |
194 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
194 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
195 | 195 | $this->model_chain_to_password = ''; |
196 | 196 | parent::__construct($timezone); |
197 | 197 | } |
@@ -11,189 +11,189 @@ |
||
11 | 11 | class EEM_Venue extends EEM_CPT_Base |
12 | 12 | { |
13 | 13 | |
14 | - // private instance of the Attendee object |
|
15 | - protected static $_instance = null; |
|
14 | + // private instance of the Attendee object |
|
15 | + protected static $_instance = null; |
|
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - protected function __construct($timezone = null) |
|
20 | - { |
|
21 | - $this->singular_item = esc_html__('Venue', 'event_espresso'); |
|
22 | - $this->plural_item = esc_html__('Venues', 'event_espresso'); |
|
23 | - $this->_tables = array( |
|
24 | - 'Venue_CPT' => new EE_Primary_Table('posts', 'ID'), |
|
25 | - 'Venue_Meta' => new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID'), |
|
26 | - ); |
|
27 | - $this->_fields = array( |
|
28 | - 'Venue_CPT' => array( |
|
29 | - 'VNU_ID' => new EE_Primary_Key_Int_Field('ID', esc_html__("Venue ID", "event_espresso")), |
|
30 | - 'VNU_name' => new EE_Plain_Text_Field( |
|
31 | - 'post_title', |
|
32 | - esc_html__("Venue Name", "event_espresso"), |
|
33 | - false, |
|
34 | - '' |
|
35 | - ), |
|
36 | - 'VNU_desc' => new EE_Post_Content_Field( |
|
37 | - 'post_content', |
|
38 | - esc_html__("Venue Description", "event_espresso"), |
|
39 | - false, |
|
40 | - '' |
|
41 | - ), |
|
42 | - 'VNU_identifier' => new EE_Slug_Field('post_name', esc_html__("Venue Identifier", "event_espresso"), false, ''), |
|
43 | - 'VNU_created' => new EE_Datetime_Field( |
|
44 | - 'post_date', |
|
45 | - esc_html__("Date Venue Created", "event_espresso"), |
|
46 | - false, |
|
47 | - EE_Datetime_Field::now |
|
48 | - ), |
|
49 | - 'VNU_short_desc' => new EE_Plain_Text_Field( |
|
50 | - 'post_excerpt', |
|
51 | - esc_html__("Short Description of Venue", "event_espresso"), |
|
52 | - true, |
|
53 | - '' |
|
54 | - ), |
|
55 | - 'VNU_modified' => new EE_Datetime_Field( |
|
56 | - 'post_modified', |
|
57 | - esc_html__("Venue Modified Date", "event_espresso"), |
|
58 | - false, |
|
59 | - EE_Datetime_Field::now |
|
60 | - ), |
|
61 | - 'VNU_wp_user' => new EE_WP_User_Field( |
|
62 | - 'post_author', |
|
63 | - esc_html__("Venue Creator ID", "event_espresso"), |
|
64 | - false |
|
65 | - ), |
|
66 | - 'parent' => new EE_Integer_Field( |
|
67 | - 'post_parent', |
|
68 | - esc_html__("Venue Parent ID", "event_espresso"), |
|
69 | - false, |
|
70 | - 0 |
|
71 | - ), |
|
72 | - 'VNU_order' => new EE_Integer_Field('menu_order', esc_html__("Venue order", "event_espresso"), false, 1), |
|
73 | - 'post_type' => new EE_WP_Post_Type_Field('espresso_venues'), |
|
74 | - 'password' => new EE_Password_Field( |
|
75 | - 'post_password', |
|
76 | - esc_html__('Password', 'event_espresso'), |
|
77 | - false, |
|
78 | - '', |
|
79 | - array( |
|
80 | - 'VNU_desc', |
|
81 | - 'VNU_short_desc', |
|
82 | - 'VNU_address', |
|
83 | - 'VNU_address2', |
|
84 | - 'VNU_city', |
|
85 | - 'STA_ID', |
|
86 | - 'CNT_ISO', |
|
87 | - 'VNU_zip', |
|
88 | - 'VNU_phone', |
|
89 | - 'VNU_capacity', |
|
90 | - 'VNU_url', |
|
91 | - 'VNU_virtual_phone', |
|
92 | - 'VNU_virtual_url', |
|
93 | - 'VNU_google_map_link', |
|
94 | - 'VNU_enable_for_gmap', |
|
95 | - ) |
|
96 | - ) |
|
97 | - ), |
|
98 | - 'Venue_Meta' => array( |
|
99 | - 'VNUM_ID' => new EE_DB_Only_Int_Field( |
|
100 | - 'VNUM_ID', |
|
101 | - esc_html__("ID of Venue Meta Row", "event_espresso"), |
|
102 | - false |
|
103 | - ), |
|
104 | - 'VNU_ID_fk' => new EE_DB_Only_Int_Field( |
|
105 | - 'VNU_ID', |
|
106 | - esc_html__("Foreign Key to Venue Post ", "event_espresso"), |
|
107 | - false |
|
108 | - ), |
|
109 | - 'VNU_address' => new EE_Plain_Text_Field( |
|
110 | - 'VNU_address', |
|
111 | - esc_html__("Venue Address line 1", "event_espresso"), |
|
112 | - true, |
|
113 | - '' |
|
114 | - ), |
|
115 | - 'VNU_address2' => new EE_Plain_Text_Field( |
|
116 | - 'VNU_address2', |
|
117 | - esc_html__("Venue Address line 2", "event_espresso"), |
|
118 | - true, |
|
119 | - '' |
|
120 | - ), |
|
121 | - 'VNU_city' => new EE_Plain_Text_Field( |
|
122 | - 'VNU_city', |
|
123 | - esc_html__("Venue City", "event_espresso"), |
|
124 | - true, |
|
125 | - '' |
|
126 | - ), |
|
127 | - 'STA_ID' => new EE_Foreign_Key_Int_Field( |
|
128 | - 'STA_ID', |
|
129 | - esc_html__("State ID", "event_espresso"), |
|
130 | - true, |
|
131 | - null, |
|
132 | - 'State' |
|
133 | - ), |
|
134 | - 'CNT_ISO' => new EE_Foreign_Key_String_Field( |
|
135 | - 'CNT_ISO', |
|
136 | - esc_html__("Country Code", "event_espresso"), |
|
137 | - true, |
|
138 | - null, |
|
139 | - 'Country' |
|
140 | - ), |
|
141 | - 'VNU_zip' => new EE_Plain_Text_Field( |
|
142 | - 'VNU_zip', |
|
143 | - esc_html__("Venue Zip/Postal Code", "event_espresso"), |
|
144 | - true |
|
145 | - ), |
|
146 | - 'VNU_phone' => new EE_Plain_Text_Field( |
|
147 | - 'VNU_phone', |
|
148 | - esc_html__("Venue Phone", "event_espresso"), |
|
149 | - true |
|
150 | - ), |
|
151 | - 'VNU_capacity' => new EE_Infinite_Integer_Field( |
|
152 | - 'VNU_capacity', |
|
153 | - esc_html__("Venue Capacity", "event_espresso"), |
|
154 | - true, |
|
155 | - EE_INF |
|
156 | - ), |
|
157 | - 'VNU_url' => new EE_Plain_Text_Field( |
|
158 | - 'VNU_url', |
|
159 | - esc_html__('Venue Website', 'event_espresso'), |
|
160 | - true |
|
161 | - ), |
|
162 | - 'VNU_virtual_phone' => new EE_Plain_Text_Field( |
|
163 | - 'VNU_virtual_phone', |
|
164 | - esc_html__('Call in Number', 'event_espresso'), |
|
165 | - true |
|
166 | - ), |
|
167 | - 'VNU_virtual_url' => new EE_Plain_Text_Field( |
|
168 | - 'VNU_virtual_url', |
|
169 | - esc_html__('Virtual URL', 'event_espresso'), |
|
170 | - true |
|
171 | - ), |
|
172 | - 'VNU_google_map_link' => new EE_Plain_Text_Field( |
|
173 | - 'VNU_google_map_link', |
|
174 | - esc_html__('Google Map Link', 'event_espresso'), |
|
175 | - true |
|
176 | - ), |
|
177 | - 'VNU_enable_for_gmap' => new EE_Boolean_Field( |
|
178 | - 'VNU_enable_for_gmap', |
|
179 | - esc_html__('Show Google Map?', 'event_espresso'), |
|
180 | - false, |
|
181 | - false |
|
182 | - ), |
|
183 | - ), |
|
184 | - ); |
|
185 | - $this->_model_relations = array( |
|
186 | - 'Event' => new EE_HABTM_Relation('Event_Venue'), |
|
187 | - 'State' => new EE_Belongs_To_Relation(), |
|
188 | - 'Country' => new EE_Belongs_To_Relation(), |
|
189 | - 'Event_Venue' => new EE_Has_Many_Relation(), |
|
190 | - 'WP_User' => new EE_Belongs_To_Relation(), |
|
191 | - 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
192 | - 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
|
193 | - ); |
|
194 | - // this model is generally available for reading |
|
195 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
196 | - $this->model_chain_to_password = ''; |
|
197 | - parent::__construct($timezone); |
|
198 | - } |
|
19 | + protected function __construct($timezone = null) |
|
20 | + { |
|
21 | + $this->singular_item = esc_html__('Venue', 'event_espresso'); |
|
22 | + $this->plural_item = esc_html__('Venues', 'event_espresso'); |
|
23 | + $this->_tables = array( |
|
24 | + 'Venue_CPT' => new EE_Primary_Table('posts', 'ID'), |
|
25 | + 'Venue_Meta' => new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID'), |
|
26 | + ); |
|
27 | + $this->_fields = array( |
|
28 | + 'Venue_CPT' => array( |
|
29 | + 'VNU_ID' => new EE_Primary_Key_Int_Field('ID', esc_html__("Venue ID", "event_espresso")), |
|
30 | + 'VNU_name' => new EE_Plain_Text_Field( |
|
31 | + 'post_title', |
|
32 | + esc_html__("Venue Name", "event_espresso"), |
|
33 | + false, |
|
34 | + '' |
|
35 | + ), |
|
36 | + 'VNU_desc' => new EE_Post_Content_Field( |
|
37 | + 'post_content', |
|
38 | + esc_html__("Venue Description", "event_espresso"), |
|
39 | + false, |
|
40 | + '' |
|
41 | + ), |
|
42 | + 'VNU_identifier' => new EE_Slug_Field('post_name', esc_html__("Venue Identifier", "event_espresso"), false, ''), |
|
43 | + 'VNU_created' => new EE_Datetime_Field( |
|
44 | + 'post_date', |
|
45 | + esc_html__("Date Venue Created", "event_espresso"), |
|
46 | + false, |
|
47 | + EE_Datetime_Field::now |
|
48 | + ), |
|
49 | + 'VNU_short_desc' => new EE_Plain_Text_Field( |
|
50 | + 'post_excerpt', |
|
51 | + esc_html__("Short Description of Venue", "event_espresso"), |
|
52 | + true, |
|
53 | + '' |
|
54 | + ), |
|
55 | + 'VNU_modified' => new EE_Datetime_Field( |
|
56 | + 'post_modified', |
|
57 | + esc_html__("Venue Modified Date", "event_espresso"), |
|
58 | + false, |
|
59 | + EE_Datetime_Field::now |
|
60 | + ), |
|
61 | + 'VNU_wp_user' => new EE_WP_User_Field( |
|
62 | + 'post_author', |
|
63 | + esc_html__("Venue Creator ID", "event_espresso"), |
|
64 | + false |
|
65 | + ), |
|
66 | + 'parent' => new EE_Integer_Field( |
|
67 | + 'post_parent', |
|
68 | + esc_html__("Venue Parent ID", "event_espresso"), |
|
69 | + false, |
|
70 | + 0 |
|
71 | + ), |
|
72 | + 'VNU_order' => new EE_Integer_Field('menu_order', esc_html__("Venue order", "event_espresso"), false, 1), |
|
73 | + 'post_type' => new EE_WP_Post_Type_Field('espresso_venues'), |
|
74 | + 'password' => new EE_Password_Field( |
|
75 | + 'post_password', |
|
76 | + esc_html__('Password', 'event_espresso'), |
|
77 | + false, |
|
78 | + '', |
|
79 | + array( |
|
80 | + 'VNU_desc', |
|
81 | + 'VNU_short_desc', |
|
82 | + 'VNU_address', |
|
83 | + 'VNU_address2', |
|
84 | + 'VNU_city', |
|
85 | + 'STA_ID', |
|
86 | + 'CNT_ISO', |
|
87 | + 'VNU_zip', |
|
88 | + 'VNU_phone', |
|
89 | + 'VNU_capacity', |
|
90 | + 'VNU_url', |
|
91 | + 'VNU_virtual_phone', |
|
92 | + 'VNU_virtual_url', |
|
93 | + 'VNU_google_map_link', |
|
94 | + 'VNU_enable_for_gmap', |
|
95 | + ) |
|
96 | + ) |
|
97 | + ), |
|
98 | + 'Venue_Meta' => array( |
|
99 | + 'VNUM_ID' => new EE_DB_Only_Int_Field( |
|
100 | + 'VNUM_ID', |
|
101 | + esc_html__("ID of Venue Meta Row", "event_espresso"), |
|
102 | + false |
|
103 | + ), |
|
104 | + 'VNU_ID_fk' => new EE_DB_Only_Int_Field( |
|
105 | + 'VNU_ID', |
|
106 | + esc_html__("Foreign Key to Venue Post ", "event_espresso"), |
|
107 | + false |
|
108 | + ), |
|
109 | + 'VNU_address' => new EE_Plain_Text_Field( |
|
110 | + 'VNU_address', |
|
111 | + esc_html__("Venue Address line 1", "event_espresso"), |
|
112 | + true, |
|
113 | + '' |
|
114 | + ), |
|
115 | + 'VNU_address2' => new EE_Plain_Text_Field( |
|
116 | + 'VNU_address2', |
|
117 | + esc_html__("Venue Address line 2", "event_espresso"), |
|
118 | + true, |
|
119 | + '' |
|
120 | + ), |
|
121 | + 'VNU_city' => new EE_Plain_Text_Field( |
|
122 | + 'VNU_city', |
|
123 | + esc_html__("Venue City", "event_espresso"), |
|
124 | + true, |
|
125 | + '' |
|
126 | + ), |
|
127 | + 'STA_ID' => new EE_Foreign_Key_Int_Field( |
|
128 | + 'STA_ID', |
|
129 | + esc_html__("State ID", "event_espresso"), |
|
130 | + true, |
|
131 | + null, |
|
132 | + 'State' |
|
133 | + ), |
|
134 | + 'CNT_ISO' => new EE_Foreign_Key_String_Field( |
|
135 | + 'CNT_ISO', |
|
136 | + esc_html__("Country Code", "event_espresso"), |
|
137 | + true, |
|
138 | + null, |
|
139 | + 'Country' |
|
140 | + ), |
|
141 | + 'VNU_zip' => new EE_Plain_Text_Field( |
|
142 | + 'VNU_zip', |
|
143 | + esc_html__("Venue Zip/Postal Code", "event_espresso"), |
|
144 | + true |
|
145 | + ), |
|
146 | + 'VNU_phone' => new EE_Plain_Text_Field( |
|
147 | + 'VNU_phone', |
|
148 | + esc_html__("Venue Phone", "event_espresso"), |
|
149 | + true |
|
150 | + ), |
|
151 | + 'VNU_capacity' => new EE_Infinite_Integer_Field( |
|
152 | + 'VNU_capacity', |
|
153 | + esc_html__("Venue Capacity", "event_espresso"), |
|
154 | + true, |
|
155 | + EE_INF |
|
156 | + ), |
|
157 | + 'VNU_url' => new EE_Plain_Text_Field( |
|
158 | + 'VNU_url', |
|
159 | + esc_html__('Venue Website', 'event_espresso'), |
|
160 | + true |
|
161 | + ), |
|
162 | + 'VNU_virtual_phone' => new EE_Plain_Text_Field( |
|
163 | + 'VNU_virtual_phone', |
|
164 | + esc_html__('Call in Number', 'event_espresso'), |
|
165 | + true |
|
166 | + ), |
|
167 | + 'VNU_virtual_url' => new EE_Plain_Text_Field( |
|
168 | + 'VNU_virtual_url', |
|
169 | + esc_html__('Virtual URL', 'event_espresso'), |
|
170 | + true |
|
171 | + ), |
|
172 | + 'VNU_google_map_link' => new EE_Plain_Text_Field( |
|
173 | + 'VNU_google_map_link', |
|
174 | + esc_html__('Google Map Link', 'event_espresso'), |
|
175 | + true |
|
176 | + ), |
|
177 | + 'VNU_enable_for_gmap' => new EE_Boolean_Field( |
|
178 | + 'VNU_enable_for_gmap', |
|
179 | + esc_html__('Show Google Map?', 'event_espresso'), |
|
180 | + false, |
|
181 | + false |
|
182 | + ), |
|
183 | + ), |
|
184 | + ); |
|
185 | + $this->_model_relations = array( |
|
186 | + 'Event' => new EE_HABTM_Relation('Event_Venue'), |
|
187 | + 'State' => new EE_Belongs_To_Relation(), |
|
188 | + 'Country' => new EE_Belongs_To_Relation(), |
|
189 | + 'Event_Venue' => new EE_Has_Many_Relation(), |
|
190 | + 'WP_User' => new EE_Belongs_To_Relation(), |
|
191 | + 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
192 | + 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
|
193 | + ); |
|
194 | + // this model is generally available for reading |
|
195 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
196 | + $this->model_chain_to_password = ''; |
|
197 | + parent::__construct($timezone); |
|
198 | + } |
|
199 | 199 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | ); |
33 | 33 | // this model is generally available for reading |
34 | 34 | $path_to_event = 'Event'; |
35 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
36 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
37 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
35 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
36 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
37 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
39 | 39 | $this->model_chain_to_password = $path_to_event; |
40 | 40 | parent::__construct($timezone); |
41 | 41 | } |
@@ -8,36 +8,36 @@ |
||
8 | 8 | */ |
9 | 9 | class EEM_Event_Venue extends EEM_Base |
10 | 10 | { |
11 | - // private instance of the Attendee object |
|
12 | - protected static $_instance = null; |
|
11 | + // private instance of the Attendee object |
|
12 | + protected static $_instance = null; |
|
13 | 13 | |
14 | - protected function __construct($timezone = null) |
|
15 | - { |
|
16 | - $this->singular_item = esc_html__('Event to Question Group Link', 'event_espresso'); |
|
17 | - $this->plural_item = esc_html__('Event to Question Group Links', 'event_espresso'); |
|
18 | - $this->_tables = array( |
|
19 | - 'Event_Venue' => new EE_Primary_Table('esp_event_venue', 'EVV_ID') |
|
20 | - ); |
|
21 | - $this->_fields = array( |
|
22 | - 'Event_Venue' => array( |
|
23 | - 'EVV_ID' => new EE_Primary_Key_Int_Field('EVV_ID', esc_html__('Event to Venue Link ID', 'event_espresso')), |
|
24 | - 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', esc_html__('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
25 | - 'VNU_ID' => new EE_Foreign_Key_Int_Field('VNU_ID', esc_html__('Venue ID', 'event_espresso'), false, 0, 'Venue'), |
|
26 | - 'EVV_primary' => new EE_Boolean_Field('EVV_primary', esc_html__("Flag indicating venue is primary one for event", "event_espresso"), false, true) |
|
14 | + protected function __construct($timezone = null) |
|
15 | + { |
|
16 | + $this->singular_item = esc_html__('Event to Question Group Link', 'event_espresso'); |
|
17 | + $this->plural_item = esc_html__('Event to Question Group Links', 'event_espresso'); |
|
18 | + $this->_tables = array( |
|
19 | + 'Event_Venue' => new EE_Primary_Table('esp_event_venue', 'EVV_ID') |
|
20 | + ); |
|
21 | + $this->_fields = array( |
|
22 | + 'Event_Venue' => array( |
|
23 | + 'EVV_ID' => new EE_Primary_Key_Int_Field('EVV_ID', esc_html__('Event to Venue Link ID', 'event_espresso')), |
|
24 | + 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', esc_html__('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
25 | + 'VNU_ID' => new EE_Foreign_Key_Int_Field('VNU_ID', esc_html__('Venue ID', 'event_espresso'), false, 0, 'Venue'), |
|
26 | + 'EVV_primary' => new EE_Boolean_Field('EVV_primary', esc_html__("Flag indicating venue is primary one for event", "event_espresso"), false, true) |
|
27 | 27 | |
28 | - ) |
|
29 | - ); |
|
30 | - $this->_model_relations = array( |
|
31 | - 'Event' => new EE_Belongs_To_Relation(), |
|
32 | - 'Venue' => new EE_Belongs_To_Relation() |
|
33 | - ); |
|
34 | - // this model is generally available for reading |
|
35 | - $path_to_event = 'Event'; |
|
36 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
37 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
39 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
40 | - $this->model_chain_to_password = $path_to_event; |
|
41 | - parent::__construct($timezone); |
|
42 | - } |
|
28 | + ) |
|
29 | + ); |
|
30 | + $this->_model_relations = array( |
|
31 | + 'Event' => new EE_Belongs_To_Relation(), |
|
32 | + 'Venue' => new EE_Belongs_To_Relation() |
|
33 | + ); |
|
34 | + // this model is generally available for reading |
|
35 | + $path_to_event = 'Event'; |
|
36 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
37 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
39 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
40 | + $this->model_chain_to_password = $path_to_event; |
|
41 | + parent::__construct($timezone); |
|
42 | + } |
|
43 | 43 | } |
@@ -12,45 +12,45 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Password_Field extends EE_Text_Field_Base |
14 | 14 | { |
15 | - /** |
|
16 | - * @var array |
|
17 | - */ |
|
18 | - protected $protected_fields; |
|
15 | + /** |
|
16 | + * @var array |
|
17 | + */ |
|
18 | + protected $protected_fields; |
|
19 | 19 | |
20 | - /** |
|
21 | - * EE_Password_Field constructor. |
|
22 | - * @param $table_column |
|
23 | - * @param $nicename |
|
24 | - * @param $nullable |
|
25 | - * @param null $default_value |
|
26 | - * @param array $protected_fields |
|
27 | - */ |
|
28 | - public function __construct($table_column, $nicename, $nullable, $default_value = null, $protected_fields = array()) |
|
29 | - { |
|
30 | - $this->protected_fields = $protected_fields; |
|
31 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
32 | - } |
|
20 | + /** |
|
21 | + * EE_Password_Field constructor. |
|
22 | + * @param $table_column |
|
23 | + * @param $nicename |
|
24 | + * @param $nullable |
|
25 | + * @param null $default_value |
|
26 | + * @param array $protected_fields |
|
27 | + */ |
|
28 | + public function __construct($table_column, $nicename, $nullable, $default_value = null, $protected_fields = array()) |
|
29 | + { |
|
30 | + $this->protected_fields = $protected_fields; |
|
31 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Returns the names of the fields on this model that this password field should protect |
|
36 | - * @since 4.9.74.p |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function protectedFields() |
|
40 | - { |
|
41 | - return $this->protected_fields; |
|
42 | - } |
|
34 | + /** |
|
35 | + * Returns the names of the fields on this model that this password field should protect |
|
36 | + * @since 4.9.74.p |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function protectedFields() |
|
40 | + { |
|
41 | + return $this->protected_fields; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Returns whether or not the specified field is protected by this model |
|
46 | - * @since 4.9.74.p |
|
47 | - * @param $field_name |
|
48 | - * @return bool |
|
49 | - */ |
|
50 | - public function fieldIsProtected($field_name) |
|
51 | - { |
|
52 | - return in_array($field_name, $this->protectedFields(), true); |
|
53 | - } |
|
44 | + /** |
|
45 | + * Returns whether or not the specified field is protected by this model |
|
46 | + * @since 4.9.74.p |
|
47 | + * @param $field_name |
|
48 | + * @return bool |
|
49 | + */ |
|
50 | + public function fieldIsProtected($field_name) |
|
51 | + { |
|
52 | + return in_array($field_name, $this->protectedFields(), true); |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | // End of file EE_Password_Field.php |
56 | 56 | // Location: ${NAMESPACE}/EE_Password_Field.php |
@@ -13,140 +13,140 @@ |
||
13 | 13 | interface RequestTypeContextCheckerInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * true if the current request involves some form of activation |
|
18 | - * |
|
19 | - * @return bool |
|
20 | - */ |
|
21 | - public function isActivation(); |
|
16 | + /** |
|
17 | + * true if the current request involves some form of activation |
|
18 | + * |
|
19 | + * @return bool |
|
20 | + */ |
|
21 | + public function isActivation(); |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @param $is_activation |
|
26 | - * @return bool |
|
27 | - */ |
|
28 | - public function setIsActivation($is_activation); |
|
24 | + /** |
|
25 | + * @param $is_activation |
|
26 | + * @return bool |
|
27 | + */ |
|
28 | + public function setIsActivation($is_activation); |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * true if the current request is for the admin and is not being made via AJAX |
|
33 | - * |
|
34 | - * @return bool |
|
35 | - */ |
|
36 | - public function isAdmin(); |
|
31 | + /** |
|
32 | + * true if the current request is for the admin and is not being made via AJAX |
|
33 | + * |
|
34 | + * @return bool |
|
35 | + */ |
|
36 | + public function isAdmin(); |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * true if the current request is for the admin AND is being made via AJAX |
|
41 | - * and the ajax request contains the request parameter "ee_admin_ajax" |
|
42 | - * |
|
43 | - * @return bool |
|
44 | - */ |
|
45 | - public function isAdminAjax(); |
|
39 | + /** |
|
40 | + * true if the current request is for the admin AND is being made via AJAX |
|
41 | + * and the ajax request contains the request parameter "ee_admin_ajax" |
|
42 | + * |
|
43 | + * @return bool |
|
44 | + */ |
|
45 | + public function isAdminAjax(); |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * true if the current request is being made via AJAX... any AJAX |
|
50 | - * |
|
51 | - * @return bool |
|
52 | - */ |
|
53 | - public function isAjax(); |
|
48 | + /** |
|
49 | + * true if the current request is being made via AJAX... any AJAX |
|
50 | + * |
|
51 | + * @return bool |
|
52 | + */ |
|
53 | + public function isAjax(); |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * true if the current request is for the EE REST API |
|
58 | - * |
|
59 | - * @return bool |
|
60 | - */ |
|
61 | - public function isApi(); |
|
56 | + /** |
|
57 | + * true if the current request is for the EE REST API |
|
58 | + * |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | + public function isApi(); |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * true if the current request is from the command line |
|
66 | - * |
|
67 | - * @return bool |
|
68 | - */ |
|
69 | - public function isCli(); |
|
64 | + /** |
|
65 | + * true if the current request is from the command line |
|
66 | + * |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | + public function isCli(); |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * true if the current request is for a WP_Cron |
|
74 | - * |
|
75 | - * @return bool |
|
76 | - */ |
|
77 | - public function isCron(); |
|
72 | + /** |
|
73 | + * true if the current request is for a WP_Cron |
|
74 | + * |
|
75 | + * @return bool |
|
76 | + */ |
|
77 | + public function isCron(); |
|
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
82 | - * |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function isEeAjax(); |
|
80 | + /** |
|
81 | + * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
82 | + * |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function isEeAjax(); |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * true if the current request is for a feed (ie: RSS) |
|
90 | - * |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - public function isFeed(); |
|
88 | + /** |
|
89 | + * true if the current request is for a feed (ie: RSS) |
|
90 | + * |
|
91 | + * @return bool |
|
92 | + */ |
|
93 | + public function isFeed(); |
|
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * true if the current request is for the frontend and is not being made via AJAX |
|
98 | - * |
|
99 | - * @return bool |
|
100 | - */ |
|
101 | - public function isFrontend(); |
|
96 | + /** |
|
97 | + * true if the current request is for the frontend and is not being made via AJAX |
|
98 | + * |
|
99 | + * @return bool |
|
100 | + */ |
|
101 | + public function isFrontend(); |
|
102 | 102 | |
103 | 103 | |
104 | - /** |
|
105 | - * @return bool |
|
106 | - */ |
|
107 | - public function isFrontAjax(); |
|
104 | + /** |
|
105 | + * @return bool |
|
106 | + */ |
|
107 | + public function isFrontAjax(); |
|
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * @return bool |
|
112 | - */ |
|
113 | - public function isIframe(); |
|
110 | + /** |
|
111 | + * @return bool |
|
112 | + */ |
|
113 | + public function isIframe(); |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * true if the current request is being made via AJAX but is NOT for EE related logic |
|
118 | - * |
|
119 | - * @return bool |
|
120 | - */ |
|
121 | - public function isOtherAjax(); |
|
116 | + /** |
|
117 | + * true if the current request is being made via AJAX but is NOT for EE related logic |
|
118 | + * |
|
119 | + * @return bool |
|
120 | + */ |
|
121 | + public function isOtherAjax(); |
|
122 | 122 | |
123 | 123 | |
124 | - /** |
|
125 | - * true if the current request is for the WP REST API |
|
126 | - * |
|
127 | - * @return bool |
|
128 | - */ |
|
129 | - public function isWordPressApi(); |
|
124 | + /** |
|
125 | + * true if the current request is for the WP REST API |
|
126 | + * |
|
127 | + * @return bool |
|
128 | + */ |
|
129 | + public function isWordPressApi(); |
|
130 | 130 | |
131 | 131 | |
132 | - /** |
|
133 | - * true if the current request is being made via AJAX for the WP Heartbeat |
|
134 | - * |
|
135 | - * @return bool |
|
136 | - */ |
|
137 | - public function isWordPressHeartbeat(); |
|
132 | + /** |
|
133 | + * true if the current request is being made via AJAX for the WP Heartbeat |
|
134 | + * |
|
135 | + * @return bool |
|
136 | + */ |
|
137 | + public function isWordPressHeartbeat(); |
|
138 | 138 | |
139 | 139 | |
140 | - /** |
|
141 | - * true if the current request is a loopback sent from WP core to test for errors |
|
142 | - * |
|
143 | - * @return bool |
|
144 | - */ |
|
145 | - public function isWordPressScrape(); |
|
140 | + /** |
|
141 | + * true if the current request is a loopback sent from WP core to test for errors |
|
142 | + * |
|
143 | + * @return bool |
|
144 | + */ |
|
145 | + public function isWordPressScrape(); |
|
146 | 146 | |
147 | 147 | |
148 | - /** |
|
149 | - * @return string |
|
150 | - */ |
|
151 | - public function slug(); |
|
148 | + /** |
|
149 | + * @return string |
|
150 | + */ |
|
151 | + public function slug(); |
|
152 | 152 | } |
@@ -17,122 +17,122 @@ |
||
17 | 17 | class RequestTypeContextFactory implements RequestTypeContextFactoryInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var LoaderInterface $loader |
|
22 | - */ |
|
23 | - private $loader; |
|
20 | + /** |
|
21 | + * @var LoaderInterface $loader |
|
22 | + */ |
|
23 | + private $loader; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * RequestTypeContextFactory constructor. |
|
28 | - * |
|
29 | - * @param LoaderInterface $loader |
|
30 | - */ |
|
31 | - public function __construct(LoaderInterface $loader) |
|
32 | - { |
|
33 | - $this->loader = $loader; |
|
34 | - } |
|
26 | + /** |
|
27 | + * RequestTypeContextFactory constructor. |
|
28 | + * |
|
29 | + * @param LoaderInterface $loader |
|
30 | + */ |
|
31 | + public function __construct(LoaderInterface $loader) |
|
32 | + { |
|
33 | + $this->loader = $loader; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @param string $slug |
|
39 | - * @return RequestTypeContext |
|
40 | - */ |
|
41 | - public function create($slug) |
|
42 | - { |
|
43 | - switch ($slug) { |
|
44 | - case RequestTypeContext::ACTIVATION: |
|
45 | - $description = esc_html__( |
|
46 | - 'The current request is for some form of activation', |
|
47 | - 'event_espresso' |
|
48 | - ); |
|
49 | - break; |
|
50 | - case RequestTypeContext::API: |
|
51 | - $description = esc_html__( |
|
52 | - 'The current request is for the EE REST API', |
|
53 | - 'event_espresso' |
|
54 | - ); |
|
55 | - break; |
|
56 | - case RequestTypeContext::AJAX_FRONT: |
|
57 | - $description = esc_html__( |
|
58 | - 'The current request is for the frontend via AJAX', |
|
59 | - 'event_espresso' |
|
60 | - ); |
|
61 | - break; |
|
62 | - case RequestTypeContext::AJAX_ADMIN: |
|
63 | - $description = esc_html__( |
|
64 | - 'The current request is for the admin via AJAX', |
|
65 | - 'event_espresso' |
|
66 | - ); |
|
67 | - break; |
|
68 | - case RequestTypeContext::AJAX_HEARTBEAT: |
|
69 | - $description = esc_html__( |
|
70 | - 'The current request is for the WP Heartbeat', |
|
71 | - 'event_espresso' |
|
72 | - ); |
|
73 | - break; |
|
74 | - case RequestTypeContext::AJAX_OTHER: |
|
75 | - $description = esc_html__( |
|
76 | - 'The current request is for non-EE related code via AJAX', |
|
77 | - 'event_espresso' |
|
78 | - ); |
|
79 | - break; |
|
80 | - case RequestTypeContext::CRON: |
|
81 | - $description = esc_html__( |
|
82 | - 'The current request is for a WP_Cron', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - break; |
|
86 | - case RequestTypeContext::CLI: |
|
87 | - $description = esc_html__( |
|
88 | - 'The current request is from the command line', |
|
89 | - 'event_espresso' |
|
90 | - ); |
|
91 | - break; |
|
92 | - case RequestTypeContext::ADMIN: |
|
93 | - $description = esc_html__( |
|
94 | - 'The current request is for the admin', |
|
95 | - 'event_espresso' |
|
96 | - ); |
|
97 | - break; |
|
98 | - case RequestTypeContext::IFRAME: |
|
99 | - $description = esc_html__( |
|
100 | - 'The current request is for an iframe', |
|
101 | - 'event_espresso' |
|
102 | - ); |
|
103 | - break; |
|
104 | - case RequestTypeContext::FEED: |
|
105 | - $description = esc_html__( |
|
106 | - 'The current request is for a feed (ie: RSS)', |
|
107 | - 'event_espresso' |
|
108 | - ); |
|
109 | - break; |
|
110 | - case RequestTypeContext::WP_API: |
|
111 | - $description = esc_html__( |
|
112 | - 'The current request is for the WordPress REST API', |
|
113 | - 'event_espresso' |
|
114 | - ); |
|
115 | - break; |
|
116 | - case RequestTypeContext::WP_SCRAPE: |
|
117 | - $description = esc_html__( |
|
118 | - 'The current request is for a WordPress loopback scrape', |
|
119 | - 'event_espresso' |
|
120 | - ); |
|
121 | - break; |
|
122 | - case RequestTypeContext::FRONTEND: |
|
123 | - default: |
|
124 | - $description = esc_html__( |
|
125 | - 'The current request is for the frontend', |
|
126 | - 'event_espresso' |
|
127 | - ); |
|
128 | - break; |
|
129 | - } |
|
130 | - // we're using the Loader with sharing turned on, |
|
131 | - // so that the generated RequestTypeContext object is accessible anywhere |
|
132 | - // by simply requesting it again from the loader |
|
133 | - return $this->loader->getShared( |
|
134 | - 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
135 | - array($slug, $description) |
|
136 | - ); |
|
137 | - } |
|
37 | + /** |
|
38 | + * @param string $slug |
|
39 | + * @return RequestTypeContext |
|
40 | + */ |
|
41 | + public function create($slug) |
|
42 | + { |
|
43 | + switch ($slug) { |
|
44 | + case RequestTypeContext::ACTIVATION: |
|
45 | + $description = esc_html__( |
|
46 | + 'The current request is for some form of activation', |
|
47 | + 'event_espresso' |
|
48 | + ); |
|
49 | + break; |
|
50 | + case RequestTypeContext::API: |
|
51 | + $description = esc_html__( |
|
52 | + 'The current request is for the EE REST API', |
|
53 | + 'event_espresso' |
|
54 | + ); |
|
55 | + break; |
|
56 | + case RequestTypeContext::AJAX_FRONT: |
|
57 | + $description = esc_html__( |
|
58 | + 'The current request is for the frontend via AJAX', |
|
59 | + 'event_espresso' |
|
60 | + ); |
|
61 | + break; |
|
62 | + case RequestTypeContext::AJAX_ADMIN: |
|
63 | + $description = esc_html__( |
|
64 | + 'The current request is for the admin via AJAX', |
|
65 | + 'event_espresso' |
|
66 | + ); |
|
67 | + break; |
|
68 | + case RequestTypeContext::AJAX_HEARTBEAT: |
|
69 | + $description = esc_html__( |
|
70 | + 'The current request is for the WP Heartbeat', |
|
71 | + 'event_espresso' |
|
72 | + ); |
|
73 | + break; |
|
74 | + case RequestTypeContext::AJAX_OTHER: |
|
75 | + $description = esc_html__( |
|
76 | + 'The current request is for non-EE related code via AJAX', |
|
77 | + 'event_espresso' |
|
78 | + ); |
|
79 | + break; |
|
80 | + case RequestTypeContext::CRON: |
|
81 | + $description = esc_html__( |
|
82 | + 'The current request is for a WP_Cron', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + break; |
|
86 | + case RequestTypeContext::CLI: |
|
87 | + $description = esc_html__( |
|
88 | + 'The current request is from the command line', |
|
89 | + 'event_espresso' |
|
90 | + ); |
|
91 | + break; |
|
92 | + case RequestTypeContext::ADMIN: |
|
93 | + $description = esc_html__( |
|
94 | + 'The current request is for the admin', |
|
95 | + 'event_espresso' |
|
96 | + ); |
|
97 | + break; |
|
98 | + case RequestTypeContext::IFRAME: |
|
99 | + $description = esc_html__( |
|
100 | + 'The current request is for an iframe', |
|
101 | + 'event_espresso' |
|
102 | + ); |
|
103 | + break; |
|
104 | + case RequestTypeContext::FEED: |
|
105 | + $description = esc_html__( |
|
106 | + 'The current request is for a feed (ie: RSS)', |
|
107 | + 'event_espresso' |
|
108 | + ); |
|
109 | + break; |
|
110 | + case RequestTypeContext::WP_API: |
|
111 | + $description = esc_html__( |
|
112 | + 'The current request is for the WordPress REST API', |
|
113 | + 'event_espresso' |
|
114 | + ); |
|
115 | + break; |
|
116 | + case RequestTypeContext::WP_SCRAPE: |
|
117 | + $description = esc_html__( |
|
118 | + 'The current request is for a WordPress loopback scrape', |
|
119 | + 'event_espresso' |
|
120 | + ); |
|
121 | + break; |
|
122 | + case RequestTypeContext::FRONTEND: |
|
123 | + default: |
|
124 | + $description = esc_html__( |
|
125 | + 'The current request is for the frontend', |
|
126 | + 'event_espresso' |
|
127 | + ); |
|
128 | + break; |
|
129 | + } |
|
130 | + // we're using the Loader with sharing turned on, |
|
131 | + // so that the generated RequestTypeContext object is accessible anywhere |
|
132 | + // by simply requesting it again from the loader |
|
133 | + return $this->loader->getShared( |
|
134 | + 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
135 | + array($slug, $description) |
|
136 | + ); |
|
137 | + } |
|
138 | 138 | } |
@@ -16,52 +16,52 @@ |
||
16 | 16 | class EventEditorHeartbeat |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var Domain $domain |
|
21 | - */ |
|
22 | - protected $domain; |
|
19 | + /** |
|
20 | + * @var Domain $domain |
|
21 | + */ |
|
22 | + protected $domain; |
|
23 | 23 | |
24 | - /** |
|
25 | - * @var EE_Environment_Config $environment |
|
26 | - */ |
|
27 | - protected $environment; |
|
24 | + /** |
|
25 | + * @var EE_Environment_Config $environment |
|
26 | + */ |
|
27 | + protected $environment; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * EventEditorHeartbeat constructor. |
|
32 | - * |
|
33 | - * @param Domain $domain |
|
34 | - * @param EE_Environment_Config $environment |
|
35 | - */ |
|
36 | - public function __construct(Domain $domain, EE_Environment_Config $environment) |
|
37 | - { |
|
38 | - $this->domain = $domain; |
|
39 | - $this->environment = $environment; |
|
40 | - if ($this->domain->isCaffeinated()) { |
|
41 | - add_filter('heartbeat_received', array($this, 'heartbeatResponse'), 10, 2); |
|
42 | - } |
|
43 | - } |
|
30 | + /** |
|
31 | + * EventEditorHeartbeat constructor. |
|
32 | + * |
|
33 | + * @param Domain $domain |
|
34 | + * @param EE_Environment_Config $environment |
|
35 | + */ |
|
36 | + public function __construct(Domain $domain, EE_Environment_Config $environment) |
|
37 | + { |
|
38 | + $this->domain = $domain; |
|
39 | + $this->environment = $environment; |
|
40 | + if ($this->domain->isCaffeinated()) { |
|
41 | + add_filter('heartbeat_received', array($this, 'heartbeatResponse'), 10, 2); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * This will be used to listen for any heartbeat data packages coming via the WordPress heartbeat API and handle |
|
48 | - * accordingly. |
|
49 | - * |
|
50 | - * @param array $response The existing heartbeat response array. |
|
51 | - * @param array $data The incoming data package. |
|
52 | - * @return array possibly appended response. |
|
53 | - */ |
|
54 | - public function heartbeatResponse($response, $data) |
|
55 | - { |
|
56 | - /** |
|
57 | - * check whether count of tickets is approaching the potential |
|
58 | - * limits for the server. |
|
59 | - */ |
|
60 | - if (! empty($data['input_count'])) { |
|
61 | - $response['max_input_vars_check'] = $this->environment->max_input_vars_limit_check( |
|
62 | - $data['input_count'] |
|
63 | - ); |
|
64 | - } |
|
65 | - return $response; |
|
66 | - } |
|
46 | + /** |
|
47 | + * This will be used to listen for any heartbeat data packages coming via the WordPress heartbeat API and handle |
|
48 | + * accordingly. |
|
49 | + * |
|
50 | + * @param array $response The existing heartbeat response array. |
|
51 | + * @param array $data The incoming data package. |
|
52 | + * @return array possibly appended response. |
|
53 | + */ |
|
54 | + public function heartbeatResponse($response, $data) |
|
55 | + { |
|
56 | + /** |
|
57 | + * check whether count of tickets is approaching the potential |
|
58 | + * limits for the server. |
|
59 | + */ |
|
60 | + if (! empty($data['input_count'])) { |
|
61 | + $response['max_input_vars_check'] = $this->environment->max_input_vars_limit_check( |
|
62 | + $data['input_count'] |
|
63 | + ); |
|
64 | + } |
|
65 | + return $response; |
|
66 | + } |
|
67 | 67 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | * check whether count of tickets is approaching the potential |
58 | 58 | * limits for the server. |
59 | 59 | */ |
60 | - if (! empty($data['input_count'])) { |
|
60 | + if ( ! empty($data['input_count'])) { |
|
61 | 61 | $response['max_input_vars_check'] = $this->environment->max_input_vars_limit_check( |
62 | 62 | $data['input_count'] |
63 | 63 | ); |
@@ -19,53 +19,53 @@ |
||
19 | 19 | */ |
20 | 20 | class SettingsForm extends PayPalSettingsForm |
21 | 21 | { |
22 | - /** |
|
23 | - * SettingsForm constructor. |
|
24 | - * |
|
25 | - * @param array $options_array |
|
26 | - * @param string $help_tab_link |
|
27 | - * @throws InvalidDataTypeException |
|
28 | - * @throws InvalidInterfaceException |
|
29 | - * @throws InvalidArgumentException |
|
30 | - */ |
|
31 | - public function __construct(array $options_array = array(), $help_tab_link = '') |
|
32 | - { |
|
33 | - $options_array = array_replace_recursive( |
|
34 | - array( |
|
35 | - 'extra_meta_inputs' => array( |
|
36 | - 'request_shipping_addr' => new EE_Yes_No_Input( |
|
37 | - array( |
|
38 | - 'html_label_text' => sprintf( |
|
39 | - esc_html__('Request Shipping Address %s', 'event_espresso'), |
|
40 | - $help_tab_link |
|
41 | - ), |
|
42 | - 'html_help_text' => esc_html__( |
|
43 | - // @codingStandardsIgnoreStart |
|
44 | - 'If set to "Yes", then a shipping address will be requested on the PayPal checkout page.', |
|
45 | - // @codingStandardsIgnoreEnd |
|
46 | - 'event_espresso' |
|
47 | - ), |
|
48 | - 'required' => true, |
|
49 | - 'default' => false, |
|
50 | - ) |
|
51 | - ), |
|
52 | - 'image_url' => new EE_Admin_File_Uploader_Input( |
|
53 | - array( |
|
54 | - 'html_label_text' => sprintf( |
|
55 | - esc_html__('Image URL %s', 'event_espresso'), |
|
56 | - $help_tab_link |
|
57 | - ), |
|
58 | - 'html_help_text' => esc_html__( |
|
59 | - 'Used for your business/personal logo on the PayPal page', |
|
60 | - 'event_espresso' |
|
61 | - ), |
|
62 | - 'required' => false, |
|
63 | - ) |
|
64 | - ), |
|
65 | - ) |
|
66 | - ), |
|
67 | - $options_array |
|
68 | - ); |
|
69 | - parent::__construct($options_array, $help_tab_link); |
|
70 | - } |
|
22 | + /** |
|
23 | + * SettingsForm constructor. |
|
24 | + * |
|
25 | + * @param array $options_array |
|
26 | + * @param string $help_tab_link |
|
27 | + * @throws InvalidDataTypeException |
|
28 | + * @throws InvalidInterfaceException |
|
29 | + * @throws InvalidArgumentException |
|
30 | + */ |
|
31 | + public function __construct(array $options_array = array(), $help_tab_link = '') |
|
32 | + { |
|
33 | + $options_array = array_replace_recursive( |
|
34 | + array( |
|
35 | + 'extra_meta_inputs' => array( |
|
36 | + 'request_shipping_addr' => new EE_Yes_No_Input( |
|
37 | + array( |
|
38 | + 'html_label_text' => sprintf( |
|
39 | + esc_html__('Request Shipping Address %s', 'event_espresso'), |
|
40 | + $help_tab_link |
|
41 | + ), |
|
42 | + 'html_help_text' => esc_html__( |
|
43 | + // @codingStandardsIgnoreStart |
|
44 | + 'If set to "Yes", then a shipping address will be requested on the PayPal checkout page.', |
|
45 | + // @codingStandardsIgnoreEnd |
|
46 | + 'event_espresso' |
|
47 | + ), |
|
48 | + 'required' => true, |
|
49 | + 'default' => false, |
|
50 | + ) |
|
51 | + ), |
|
52 | + 'image_url' => new EE_Admin_File_Uploader_Input( |
|
53 | + array( |
|
54 | + 'html_label_text' => sprintf( |
|
55 | + esc_html__('Image URL %s', 'event_espresso'), |
|
56 | + $help_tab_link |
|
57 | + ), |
|
58 | + 'html_help_text' => esc_html__( |
|
59 | + 'Used for your business/personal logo on the PayPal page', |
|
60 | + 'event_espresso' |
|
61 | + ), |
|
62 | + 'required' => false, |
|
63 | + ) |
|
64 | + ), |
|
65 | + ) |
|
66 | + ), |
|
67 | + $options_array |
|
68 | + ); |
|
69 | + parent::__construct($options_array, $help_tab_link); |
|
70 | + } |
|
71 | 71 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | ); |
33 | 33 | // this model is generally available for reading |
34 | 34 | $path_to_event = 'Event'; |
35 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
36 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
37 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
35 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
36 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
37 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
39 | 39 | parent::__construct($timezone); |
40 | 40 | } |
41 | 41 |
@@ -8,72 +8,72 @@ |
||
8 | 8 | */ |
9 | 9 | class EEM_Event_Question_Group extends EEM_Base |
10 | 10 | { |
11 | - /** |
|
12 | - * Name of the field indicating an event should use the question group for the primary attendee |
|
13 | - */ |
|
14 | - const PRIMARY = 'EQG_primary'; |
|
11 | + /** |
|
12 | + * Name of the field indicating an event should use the question group for the primary attendee |
|
13 | + */ |
|
14 | + const PRIMARY = 'EQG_primary'; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Name of hte field indicating an event should use the question group for additional attendees |
|
18 | - */ |
|
19 | - const ADDITIONAL = 'EQG_additional'; |
|
16 | + /** |
|
17 | + * Name of hte field indicating an event should use the question group for additional attendees |
|
18 | + */ |
|
19 | + const ADDITIONAL = 'EQG_additional'; |
|
20 | 20 | |
21 | - // private instance of the Event_Question_Group object |
|
22 | - protected static $_instance = null; |
|
21 | + // private instance of the Event_Question_Group object |
|
22 | + protected static $_instance = null; |
|
23 | 23 | |
24 | - protected function __construct($timezone = null) |
|
25 | - { |
|
26 | - $this->singular_item = esc_html__('Event to Question Group Link', 'event_espresso'); |
|
27 | - $this->plural_item = esc_html__('Event to Question Group Links', 'event_espresso'); |
|
28 | - $this->_tables = array( |
|
29 | - 'Event_Question_Group' => new EE_Primary_Table('esp_event_question_group', 'EQG_ID') |
|
30 | - ); |
|
31 | - $this->_fields = array( |
|
32 | - 'Event_Question_Group' => array( |
|
33 | - 'EQG_ID' => new EE_Primary_Key_Int_Field('EQG_ID', esc_html__('Event to Question Group Link ID', 'event_espresso')), |
|
34 | - 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', esc_html__('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
35 | - 'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID', esc_html__('Question Group Id', 'event_espresso'), false, 0, 'Question_Group'), |
|
36 | - 'EQG_primary' => new EE_Boolean_Field('EQG_primary', esc_html__('Flag indicating question is only for primary attendees', 'event_espresso'), false, false), |
|
37 | - 'EQG_additional' => new EE_Boolean_Field('EQG_additional', esc_html__('Flag indicating question is only for additional attendees', 'event_espresso'), false, false) |
|
38 | - ) |
|
39 | - ); |
|
40 | - $this->_model_relations = array( |
|
41 | - 'Event' => new EE_Belongs_To_Relation(), |
|
42 | - 'Question_Group' => new EE_Belongs_To_Relation() |
|
43 | - ); |
|
44 | - // this model is generally available for reading |
|
45 | - $path_to_event = 'Event'; |
|
46 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
47 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
48 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
49 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
50 | - parent::__construct($timezone); |
|
51 | - } |
|
24 | + protected function __construct($timezone = null) |
|
25 | + { |
|
26 | + $this->singular_item = esc_html__('Event to Question Group Link', 'event_espresso'); |
|
27 | + $this->plural_item = esc_html__('Event to Question Group Links', 'event_espresso'); |
|
28 | + $this->_tables = array( |
|
29 | + 'Event_Question_Group' => new EE_Primary_Table('esp_event_question_group', 'EQG_ID') |
|
30 | + ); |
|
31 | + $this->_fields = array( |
|
32 | + 'Event_Question_Group' => array( |
|
33 | + 'EQG_ID' => new EE_Primary_Key_Int_Field('EQG_ID', esc_html__('Event to Question Group Link ID', 'event_espresso')), |
|
34 | + 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', esc_html__('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
35 | + 'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID', esc_html__('Question Group Id', 'event_espresso'), false, 0, 'Question_Group'), |
|
36 | + 'EQG_primary' => new EE_Boolean_Field('EQG_primary', esc_html__('Flag indicating question is only for primary attendees', 'event_espresso'), false, false), |
|
37 | + 'EQG_additional' => new EE_Boolean_Field('EQG_additional', esc_html__('Flag indicating question is only for additional attendees', 'event_espresso'), false, false) |
|
38 | + ) |
|
39 | + ); |
|
40 | + $this->_model_relations = array( |
|
41 | + 'Event' => new EE_Belongs_To_Relation(), |
|
42 | + 'Question_Group' => new EE_Belongs_To_Relation() |
|
43 | + ); |
|
44 | + // this model is generally available for reading |
|
45 | + $path_to_event = 'Event'; |
|
46 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
47 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
48 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
49 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
50 | + parent::__construct($timezone); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Decides whether to use the 'EQG_primary' or newer 'EQG_additional' for use in queries, based on whether |
|
55 | - * this is concerning primary attendees or additional attendees. |
|
56 | - * If 1, true, or "primary" is passed in, returns EQG_primary. If 0, false, or "additional" is passed in, returns |
|
57 | - * EQG_additional. |
|
58 | - * @since 4.10.0.p |
|
59 | - * @param string|boolean|int $context |
|
60 | - * @return string |
|
61 | - */ |
|
62 | - public function fieldNameForContext($context) |
|
63 | - { |
|
64 | - // Basically do a strict switch statement. |
|
65 | - switch (true) { |
|
66 | - case $context === 'additional': |
|
67 | - case $context === false: |
|
68 | - case $context === 0: |
|
69 | - $field_name = EEM_Event_Question_Group::ADDITIONAL; |
|
70 | - break; |
|
71 | - case $context === 'primary': |
|
72 | - case $context === true: |
|
73 | - case $context === 1: |
|
74 | - default: |
|
75 | - $field_name = EEM_Event_Question_Group::PRIMARY; |
|
76 | - } |
|
77 | - return apply_filters('FHEE__EEM_Event_Question_Group__fieldNameForContext', $field_name, $context); |
|
78 | - } |
|
53 | + /** |
|
54 | + * Decides whether to use the 'EQG_primary' or newer 'EQG_additional' for use in queries, based on whether |
|
55 | + * this is concerning primary attendees or additional attendees. |
|
56 | + * If 1, true, or "primary" is passed in, returns EQG_primary. If 0, false, or "additional" is passed in, returns |
|
57 | + * EQG_additional. |
|
58 | + * @since 4.10.0.p |
|
59 | + * @param string|boolean|int $context |
|
60 | + * @return string |
|
61 | + */ |
|
62 | + public function fieldNameForContext($context) |
|
63 | + { |
|
64 | + // Basically do a strict switch statement. |
|
65 | + switch (true) { |
|
66 | + case $context === 'additional': |
|
67 | + case $context === false: |
|
68 | + case $context === 0: |
|
69 | + $field_name = EEM_Event_Question_Group::ADDITIONAL; |
|
70 | + break; |
|
71 | + case $context === 'primary': |
|
72 | + case $context === true: |
|
73 | + case $context === 1: |
|
74 | + default: |
|
75 | + $field_name = EEM_Event_Question_Group::PRIMARY; |
|
76 | + } |
|
77 | + return apply_filters('FHEE__EEM_Event_Question_Group__fieldNameForContext', $field_name, $context); |
|
78 | + } |
|
79 | 79 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | : []; |
135 | 135 | $EQGids = array_keys($EQGs); |
136 | 136 | |
137 | - if (! empty($QSGs)) { |
|
137 | + if ( ! empty($QSGs)) { |
|
138 | 138 | $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
139 | 139 | foreach ($QSGs as $QSG) { |
140 | 140 | $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | ); |
148 | 148 | |
149 | 149 | $html .= ' |
150 | - <p id="event-question-group-' . $QSG->ID() . '"> |
|
151 | - <input value="' . $QSG->ID() . '"' |
|
152 | - . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
153 | - <a href="' . $edit_link . '" title="' |
|
150 | + <p id="event-question-group-' . $QSG->ID().'"> |
|
151 | + <input value="' . $QSG->ID().'"' |
|
152 | + . ' type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' /> |
|
153 | + <a href="' . $edit_link.'" title="' |
|
154 | 154 | . sprintf( |
155 | 155 | esc_attr__('Edit %s Group', 'event_espresso'), |
156 | 156 | $QSG->get('QSG_name') |
157 | 157 | ) |
158 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
158 | + . '" target="_blank">'.$QSG->get('QSG_name').'</a> |
|
159 | 159 | </p>'; |
160 | 160 | if ($QSG->ID() === 2) { |
161 | 161 | $html .= ' |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $current_qgs = array_keys($current_qgs); // we just want the ids |
200 | 200 | |
201 | 201 | // now let's get the groups selected in the editor and update (IF we have data) |
202 | - if (! empty($question_groups)) { |
|
202 | + if ( ! empty($question_groups)) { |
|
203 | 203 | foreach ($question_groups as $qgid) { |
204 | 204 | // add to event |
205 | 205 | if ($qgid) { |
@@ -16,208 +16,208 @@ |
||
16 | 16 | class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * extending the properties set in espresso_events_Registration_From_Hooks |
|
21 | - * |
|
22 | - * @access protected |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - protected function _extend_properties() |
|
26 | - { |
|
27 | - $this->_metaboxes = array_merge( |
|
28 | - $this->_metaboxes, |
|
29 | - array( |
|
30 | - 1 => array( |
|
31 | - 'page_route' => array('create_new', 'edit'), |
|
32 | - 'func' => 'additional_questions', |
|
33 | - 'label' => esc_html__('Questions for Additional Registrants', 'event_espresso'), |
|
34 | - 'priority' => 'default', |
|
35 | - 'context' => 'side', |
|
36 | - ), |
|
37 | - ) |
|
38 | - ); |
|
39 | - $this->_scripts_styles = array( |
|
40 | - 'registers' => array( |
|
41 | - 'extended-event-editor' => array( |
|
42 | - 'url' => EE_CORE_CAF_ADMIN_EXTEND_URL |
|
43 | - . 'registration_form/assets/event-editor-question-groups.js', |
|
44 | - 'depends' => array('jquery'), |
|
45 | - ), |
|
46 | - ), |
|
47 | - 'enqueues' => array( |
|
48 | - 'extended-event-editor' => array('edit', 'create_new'), |
|
49 | - ), |
|
50 | - ); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @param Callable[] $callbacks |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function modify_callbacks($callbacks) |
|
59 | - { |
|
60 | - $callbacks = parent::modify_callbacks($callbacks); |
|
61 | - $callbacks[] = array($this, 'additional_question_group_update'); |
|
62 | - return $callbacks; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Call back hooked into revision restores. |
|
68 | - * |
|
69 | - * @param $post_id |
|
70 | - * @param $revision_id |
|
71 | - * @return EE_Base_Class|void |
|
72 | - * @throws EE_Error |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws InvalidDataTypeException |
|
75 | - * @throws InvalidInterfaceException |
|
76 | - * @throws ReflectionException |
|
77 | - */ |
|
78 | - public function restore_revision($post_id, $revision_id) |
|
79 | - { |
|
80 | - $post_evt = parent::restore_revision($post_id, $revision_id); |
|
81 | - |
|
82 | - // restore revision for additional questions |
|
83 | - $post_evt->restore_revision( |
|
84 | - $revision_id, |
|
85 | - ['Question_Group'], |
|
86 | - [ |
|
87 | - 'Question_Group' => ['Event_Question_Group.EQG_additional' => true], |
|
88 | - ] |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param $post_id |
|
95 | - * @param $post |
|
96 | - * @throws EE_Error |
|
97 | - * @throws InvalidArgumentException |
|
98 | - * @throws InvalidDataTypeException |
|
99 | - * @throws InvalidInterfaceException |
|
100 | - */ |
|
101 | - public function additional_questions($post_id, $post) |
|
102 | - { |
|
103 | - $this->_event = $this->_adminpage_obj->get_event_object(); |
|
104 | - $event_id = $this->_event->ID(); |
|
105 | - ?> |
|
19 | + /** |
|
20 | + * extending the properties set in espresso_events_Registration_From_Hooks |
|
21 | + * |
|
22 | + * @access protected |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + protected function _extend_properties() |
|
26 | + { |
|
27 | + $this->_metaboxes = array_merge( |
|
28 | + $this->_metaboxes, |
|
29 | + array( |
|
30 | + 1 => array( |
|
31 | + 'page_route' => array('create_new', 'edit'), |
|
32 | + 'func' => 'additional_questions', |
|
33 | + 'label' => esc_html__('Questions for Additional Registrants', 'event_espresso'), |
|
34 | + 'priority' => 'default', |
|
35 | + 'context' => 'side', |
|
36 | + ), |
|
37 | + ) |
|
38 | + ); |
|
39 | + $this->_scripts_styles = array( |
|
40 | + 'registers' => array( |
|
41 | + 'extended-event-editor' => array( |
|
42 | + 'url' => EE_CORE_CAF_ADMIN_EXTEND_URL |
|
43 | + . 'registration_form/assets/event-editor-question-groups.js', |
|
44 | + 'depends' => array('jquery'), |
|
45 | + ), |
|
46 | + ), |
|
47 | + 'enqueues' => array( |
|
48 | + 'extended-event-editor' => array('edit', 'create_new'), |
|
49 | + ), |
|
50 | + ); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @param Callable[] $callbacks |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function modify_callbacks($callbacks) |
|
59 | + { |
|
60 | + $callbacks = parent::modify_callbacks($callbacks); |
|
61 | + $callbacks[] = array($this, 'additional_question_group_update'); |
|
62 | + return $callbacks; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Call back hooked into revision restores. |
|
68 | + * |
|
69 | + * @param $post_id |
|
70 | + * @param $revision_id |
|
71 | + * @return EE_Base_Class|void |
|
72 | + * @throws EE_Error |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws InvalidDataTypeException |
|
75 | + * @throws InvalidInterfaceException |
|
76 | + * @throws ReflectionException |
|
77 | + */ |
|
78 | + public function restore_revision($post_id, $revision_id) |
|
79 | + { |
|
80 | + $post_evt = parent::restore_revision($post_id, $revision_id); |
|
81 | + |
|
82 | + // restore revision for additional questions |
|
83 | + $post_evt->restore_revision( |
|
84 | + $revision_id, |
|
85 | + ['Question_Group'], |
|
86 | + [ |
|
87 | + 'Question_Group' => ['Event_Question_Group.EQG_additional' => true], |
|
88 | + ] |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param $post_id |
|
95 | + * @param $post |
|
96 | + * @throws EE_Error |
|
97 | + * @throws InvalidArgumentException |
|
98 | + * @throws InvalidDataTypeException |
|
99 | + * @throws InvalidInterfaceException |
|
100 | + */ |
|
101 | + public function additional_questions($post_id, $post) |
|
102 | + { |
|
103 | + $this->_event = $this->_adminpage_obj->get_event_object(); |
|
104 | + $event_id = $this->_event->ID(); |
|
105 | + ?> |
|
106 | 106 | <div class="inside"> |
107 | 107 | <p><strong> |
108 | 108 | <?php esc_html_e('Question Groups', 'event_espresso'); ?> |
109 | 109 | </strong><br/> |
110 | 110 | <?php |
111 | - printf( |
|
112 | - esc_html__( |
|
113 | - 'Add a pre-populated %1$sgroup of questions%2$s to your event.', |
|
114 | - 'event_espresso' |
|
115 | - ), |
|
116 | - '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
117 | - '</a>' |
|
118 | - ); |
|
119 | - ?> |
|
111 | + printf( |
|
112 | + esc_html__( |
|
113 | + 'Add a pre-populated %1$sgroup of questions%2$s to your event.', |
|
114 | + 'event_espresso' |
|
115 | + ), |
|
116 | + '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
117 | + '</a>' |
|
118 | + ); |
|
119 | + ?> |
|
120 | 120 | </p> |
121 | 121 | <?php |
122 | 122 | |
123 | - $qsg_where['QSG_deleted'] = false; |
|
124 | - $query_params = apply_filters( |
|
125 | - 'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters', |
|
126 | - array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
127 | - ); |
|
128 | - $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
129 | - $EQGs = ! empty($event_id) |
|
130 | - ? $this->_event->get_many_related( |
|
131 | - 'Question_Group', |
|
132 | - [['Event_Question_Group.EQG_additional' => true]] |
|
133 | - ) |
|
134 | - : []; |
|
135 | - $EQGids = array_keys($EQGs); |
|
136 | - |
|
137 | - if (! empty($QSGs)) { |
|
138 | - $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
139 | - foreach ($QSGs as $QSG) { |
|
140 | - $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
|
141 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
142 | - array( |
|
143 | - 'action' => 'edit_question_group', |
|
144 | - 'QSG_ID' => $QSG->ID(), |
|
145 | - ), |
|
146 | - EE_FORMS_ADMIN_URL |
|
147 | - ); |
|
148 | - |
|
149 | - $html .= ' |
|
123 | + $qsg_where['QSG_deleted'] = false; |
|
124 | + $query_params = apply_filters( |
|
125 | + 'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters', |
|
126 | + array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
127 | + ); |
|
128 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
129 | + $EQGs = ! empty($event_id) |
|
130 | + ? $this->_event->get_many_related( |
|
131 | + 'Question_Group', |
|
132 | + [['Event_Question_Group.EQG_additional' => true]] |
|
133 | + ) |
|
134 | + : []; |
|
135 | + $EQGids = array_keys($EQGs); |
|
136 | + |
|
137 | + if (! empty($QSGs)) { |
|
138 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
139 | + foreach ($QSGs as $QSG) { |
|
140 | + $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
|
141 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
142 | + array( |
|
143 | + 'action' => 'edit_question_group', |
|
144 | + 'QSG_ID' => $QSG->ID(), |
|
145 | + ), |
|
146 | + EE_FORMS_ADMIN_URL |
|
147 | + ); |
|
148 | + |
|
149 | + $html .= ' |
|
150 | 150 | <p id="event-question-group-' . $QSG->ID() . '"> |
151 | 151 | <input value="' . $QSG->ID() . '"' |
152 | - . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
152 | + . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
153 | 153 | <a href="' . $edit_link . '" title="' |
154 | - . sprintf( |
|
155 | - esc_attr__('Edit %s Group', 'event_espresso'), |
|
156 | - $QSG->get('QSG_name') |
|
157 | - ) |
|
158 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
154 | + . sprintf( |
|
155 | + esc_attr__('Edit %s Group', 'event_espresso'), |
|
156 | + $QSG->get('QSG_name') |
|
157 | + ) |
|
158 | + . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
159 | 159 | </p>'; |
160 | - if ($QSG->ID() === 2) { |
|
161 | - $html .= ' |
|
160 | + if ($QSG->ID() === 2) { |
|
161 | + $html .= ' |
|
162 | 162 | <p id="question-group-requirements-notice-pg" class="important-notice small-text" style="display: none;">' |
163 | - . esc_html__( |
|
164 | - 'The Personal Information question group is required whenever the Address Information question group is activated.', |
|
165 | - 'event_espresso' |
|
166 | - ) |
|
167 | - . '</p>'; |
|
168 | - } |
|
169 | - } |
|
170 | - $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | - |
|
172 | - echo $html; |
|
173 | - } else { |
|
174 | - esc_html_e( |
|
175 | - 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | - 'event_espresso' |
|
177 | - ); |
|
178 | - } |
|
179 | - do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
180 | - ?> |
|
163 | + . esc_html__( |
|
164 | + 'The Personal Information question group is required whenever the Address Information question group is activated.', |
|
165 | + 'event_espresso' |
|
166 | + ) |
|
167 | + . '</p>'; |
|
168 | + } |
|
169 | + } |
|
170 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | + |
|
172 | + echo $html; |
|
173 | + } else { |
|
174 | + esc_html_e( |
|
175 | + 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | + 'event_espresso' |
|
177 | + ); |
|
178 | + } |
|
179 | + do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
180 | + ?> |
|
181 | 181 | </div> |
182 | 182 | <?php |
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - public function additional_question_group_update($evtobj, $data) |
|
187 | - { |
|
188 | - $question_groups = ! empty($data['add_attendee_question_groups']) |
|
189 | - ? (array) $data['add_attendee_question_groups'] |
|
190 | - : []; |
|
191 | - $added_qgs = array_keys($question_groups); |
|
192 | - $success = []; |
|
193 | - |
|
194 | - // let's get all current question groups associated with this event. |
|
195 | - $current_qgs = $evtobj->get_many_related( |
|
196 | - 'Question_Group', |
|
197 | - [['Event_Question_Group.EQG_additional' => true]] |
|
198 | - ); |
|
199 | - $current_qgs = array_keys($current_qgs); // we just want the ids |
|
200 | - |
|
201 | - // now let's get the groups selected in the editor and update (IF we have data) |
|
202 | - if (! empty($question_groups)) { |
|
203 | - foreach ($question_groups as $qgid) { |
|
204 | - // add to event |
|
205 | - if ($qgid) { |
|
206 | - $qg = $evtobj->add_question_group($qgid, false); |
|
207 | - } |
|
208 | - $success[] = ! empty($qg) ? 1 : 0; |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
213 | - $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
214 | - |
|
215 | - foreach ($removed_qgs as $qgid) { |
|
216 | - $qg = $evtobj->remove_question_group($qgid, false); |
|
217 | - $success[] = ! empty($qg) ? 1 : 0; |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - return in_array(0, $success, true) ? false : true; |
|
222 | - } |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + public function additional_question_group_update($evtobj, $data) |
|
187 | + { |
|
188 | + $question_groups = ! empty($data['add_attendee_question_groups']) |
|
189 | + ? (array) $data['add_attendee_question_groups'] |
|
190 | + : []; |
|
191 | + $added_qgs = array_keys($question_groups); |
|
192 | + $success = []; |
|
193 | + |
|
194 | + // let's get all current question groups associated with this event. |
|
195 | + $current_qgs = $evtobj->get_many_related( |
|
196 | + 'Question_Group', |
|
197 | + [['Event_Question_Group.EQG_additional' => true]] |
|
198 | + ); |
|
199 | + $current_qgs = array_keys($current_qgs); // we just want the ids |
|
200 | + |
|
201 | + // now let's get the groups selected in the editor and update (IF we have data) |
|
202 | + if (! empty($question_groups)) { |
|
203 | + foreach ($question_groups as $qgid) { |
|
204 | + // add to event |
|
205 | + if ($qgid) { |
|
206 | + $qg = $evtobj->add_question_group($qgid, false); |
|
207 | + } |
|
208 | + $success[] = ! empty($qg) ? 1 : 0; |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
213 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
214 | + |
|
215 | + foreach ($removed_qgs as $qgid) { |
|
216 | + $qg = $evtobj->remove_question_group($qgid, false); |
|
217 | + $success[] = ! empty($qg) ? 1 : 0; |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + return in_array(0, $success, true) ? false : true; |
|
222 | + } |
|
223 | 223 | } |