@@ -24,108 +24,108 @@ |
||
24 | 24 | */ |
25 | 25 | class Registration extends RegistrationCalculationBase |
26 | 26 | { |
27 | - /** |
|
28 | - * @var EEM_Registration |
|
29 | - */ |
|
30 | - protected $registration_model; |
|
27 | + /** |
|
28 | + * @var EEM_Registration |
|
29 | + */ |
|
30 | + protected $registration_model; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Registration constructor. |
|
34 | - * @param EEM_Registration $registration_model |
|
35 | - */ |
|
36 | - public function __construct(EEM_Registration $registration_model) |
|
37 | - { |
|
38 | - $this->registration_model = $registration_model; |
|
39 | - } |
|
32 | + /** |
|
33 | + * Registration constructor. |
|
34 | + * @param EEM_Registration $registration_model |
|
35 | + */ |
|
36 | + public function __construct(EEM_Registration $registration_model) |
|
37 | + { |
|
38 | + $this->registration_model = $registration_model; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Calculates the checkin status for each datetime this registration has access to |
|
43 | - * |
|
44 | - * @param array $wpdb_row |
|
45 | - * @param WP_REST_Request $request |
|
46 | - * @param RegistrationControllerBase $controller |
|
47 | - * @return array |
|
48 | - * @throws EE_Error |
|
49 | - * @throws InvalidDataTypeException |
|
50 | - * @throws InvalidInterfaceException |
|
51 | - * @throws InvalidArgumentException |
|
52 | - */ |
|
53 | - public function datetimeCheckinStati($wpdb_row, $request, $controller) |
|
54 | - { |
|
55 | - if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
56 | - $reg = $this->registration_model->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
57 | - } else { |
|
58 | - $reg = null; |
|
59 | - } |
|
60 | - if (! $reg instanceof EE_Registration |
|
61 | - ) { |
|
62 | - throw new EE_Error( |
|
63 | - sprintf( |
|
64 | - __( |
|
65 | - // @codingStandardsIgnoreStart |
|
66 | - 'Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', |
|
67 | - // @codingStandardsIgnoreEnd |
|
68 | - 'event_espresso' |
|
69 | - ), |
|
70 | - $wpdb_row['Registration.REG_ID'], |
|
71 | - print_r($wpdb_row, true) |
|
72 | - ) |
|
73 | - ); |
|
74 | - } |
|
75 | - $datetime_ids = EEM_Datetime::instance()->get_col( |
|
76 | - [ |
|
77 | - [ |
|
78 | - 'Ticket.TKT_ID' => $reg->ticket_ID(), |
|
79 | - ], |
|
80 | - 'default_where_conditions' => EEM_Base::default_where_conditions_minimum_all, |
|
81 | - ] |
|
82 | - ); |
|
83 | - $checkin_stati = array(); |
|
84 | - foreach ($datetime_ids as $datetime_id) { |
|
85 | - $status = $reg->check_in_status_for_datetime($datetime_id); |
|
86 | - switch ($status) { |
|
87 | - case EE_Checkin::status_checked_out: |
|
88 | - $status_pretty = 'OUT'; |
|
89 | - break; |
|
90 | - case EE_Checkin::status_checked_in: |
|
91 | - $status_pretty = 'IN'; |
|
92 | - break; |
|
93 | - case EE_Checkin::status_checked_never: |
|
94 | - default: |
|
95 | - $status_pretty = 'NEVER'; |
|
96 | - break; |
|
97 | - } |
|
98 | - $checkin_stati[ $datetime_id ] = $status_pretty; |
|
99 | - } |
|
100 | - return $checkin_stati; |
|
101 | - } |
|
41 | + /** |
|
42 | + * Calculates the checkin status for each datetime this registration has access to |
|
43 | + * |
|
44 | + * @param array $wpdb_row |
|
45 | + * @param WP_REST_Request $request |
|
46 | + * @param RegistrationControllerBase $controller |
|
47 | + * @return array |
|
48 | + * @throws EE_Error |
|
49 | + * @throws InvalidDataTypeException |
|
50 | + * @throws InvalidInterfaceException |
|
51 | + * @throws InvalidArgumentException |
|
52 | + */ |
|
53 | + public function datetimeCheckinStati($wpdb_row, $request, $controller) |
|
54 | + { |
|
55 | + if (is_array($wpdb_row) && isset($wpdb_row['Registration.REG_ID'])) { |
|
56 | + $reg = $this->registration_model->get_one_by_ID($wpdb_row['Registration.REG_ID']); |
|
57 | + } else { |
|
58 | + $reg = null; |
|
59 | + } |
|
60 | + if (! $reg instanceof EE_Registration |
|
61 | + ) { |
|
62 | + throw new EE_Error( |
|
63 | + sprintf( |
|
64 | + __( |
|
65 | + // @codingStandardsIgnoreStart |
|
66 | + 'Cannot calculate datetime_checkin_stati because the registration with ID %1$s (from database row %2$s) was not found', |
|
67 | + // @codingStandardsIgnoreEnd |
|
68 | + 'event_espresso' |
|
69 | + ), |
|
70 | + $wpdb_row['Registration.REG_ID'], |
|
71 | + print_r($wpdb_row, true) |
|
72 | + ) |
|
73 | + ); |
|
74 | + } |
|
75 | + $datetime_ids = EEM_Datetime::instance()->get_col( |
|
76 | + [ |
|
77 | + [ |
|
78 | + 'Ticket.TKT_ID' => $reg->ticket_ID(), |
|
79 | + ], |
|
80 | + 'default_where_conditions' => EEM_Base::default_where_conditions_minimum_all, |
|
81 | + ] |
|
82 | + ); |
|
83 | + $checkin_stati = array(); |
|
84 | + foreach ($datetime_ids as $datetime_id) { |
|
85 | + $status = $reg->check_in_status_for_datetime($datetime_id); |
|
86 | + switch ($status) { |
|
87 | + case EE_Checkin::status_checked_out: |
|
88 | + $status_pretty = 'OUT'; |
|
89 | + break; |
|
90 | + case EE_Checkin::status_checked_in: |
|
91 | + $status_pretty = 'IN'; |
|
92 | + break; |
|
93 | + case EE_Checkin::status_checked_never: |
|
94 | + default: |
|
95 | + $status_pretty = 'NEVER'; |
|
96 | + break; |
|
97 | + } |
|
98 | + $checkin_stati[ $datetime_id ] = $status_pretty; |
|
99 | + } |
|
100 | + return $checkin_stati; |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | - /** |
|
105 | - * Provides an array for all the calculations possible that outlines a json schema for those calculations. |
|
106 | - * Array is indexed by calculation (snake case) and value is the schema for that calculation. |
|
107 | - * |
|
108 | - * @since 4.9.68.p |
|
109 | - * @return array |
|
110 | - */ |
|
111 | - public function schemaForCalculations() |
|
112 | - { |
|
113 | - return array( |
|
114 | - 'datetime_checkin_stati' => array( |
|
115 | - 'description' => esc_html__( |
|
116 | - 'Returns the checkin status for each datetime this registration has access to.', |
|
117 | - 'event_espresso' |
|
118 | - ), |
|
119 | - 'type' => 'object', |
|
120 | - 'properties' => array(), |
|
121 | - 'additionalProperties' => array( |
|
122 | - 'description' => esc_html__( |
|
123 | - 'Keys are date-time ids and values are the check-in status', |
|
124 | - 'event_espresso' |
|
125 | - ), |
|
126 | - 'type' => 'string' |
|
127 | - ), |
|
128 | - ), |
|
129 | - ); |
|
130 | - } |
|
104 | + /** |
|
105 | + * Provides an array for all the calculations possible that outlines a json schema for those calculations. |
|
106 | + * Array is indexed by calculation (snake case) and value is the schema for that calculation. |
|
107 | + * |
|
108 | + * @since 4.9.68.p |
|
109 | + * @return array |
|
110 | + */ |
|
111 | + public function schemaForCalculations() |
|
112 | + { |
|
113 | + return array( |
|
114 | + 'datetime_checkin_stati' => array( |
|
115 | + 'description' => esc_html__( |
|
116 | + 'Returns the checkin status for each datetime this registration has access to.', |
|
117 | + 'event_espresso' |
|
118 | + ), |
|
119 | + 'type' => 'object', |
|
120 | + 'properties' => array(), |
|
121 | + 'additionalProperties' => array( |
|
122 | + 'description' => esc_html__( |
|
123 | + 'Keys are date-time ids and values are the check-in status', |
|
124 | + 'event_espresso' |
|
125 | + ), |
|
126 | + 'type' => 'string' |
|
127 | + ), |
|
128 | + ), |
|
129 | + ); |
|
130 | + } |
|
131 | 131 | } |
@@ -44,531 +44,531 @@ |
||
44 | 44 | class OrganizationSettings extends FormHandler |
45 | 45 | { |
46 | 46 | |
47 | - /** |
|
48 | - * @var EE_Organization_Config |
|
49 | - */ |
|
50 | - protected $organization_config; |
|
47 | + /** |
|
48 | + * @var EE_Organization_Config |
|
49 | + */ |
|
50 | + protected $organization_config; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @var EE_Core_Config |
|
54 | - */ |
|
55 | - protected $core_config; |
|
52 | + /** |
|
53 | + * @var EE_Core_Config |
|
54 | + */ |
|
55 | + protected $core_config; |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * @var EE_Network_Core_Config |
|
60 | - */ |
|
61 | - protected $network_core_config; |
|
58 | + /** |
|
59 | + * @var EE_Network_Core_Config |
|
60 | + */ |
|
61 | + protected $network_core_config; |
|
62 | 62 | |
63 | - /** |
|
64 | - * @var CountrySubRegionDao $countrySubRegionDao |
|
65 | - */ |
|
66 | - protected $countrySubRegionDao; |
|
63 | + /** |
|
64 | + * @var CountrySubRegionDao $countrySubRegionDao |
|
65 | + */ |
|
66 | + protected $countrySubRegionDao; |
|
67 | 67 | |
68 | - /** |
|
69 | - * Form constructor. |
|
70 | - * |
|
71 | - * @param EE_Registry $registry |
|
72 | - * @param EE_Organization_Config $organization_config |
|
73 | - * @param EE_Core_Config $core_config |
|
74 | - * @param EE_Network_Core_Config $network_core_config |
|
75 | - * @param CountrySubRegionDao $countrySubRegionDao |
|
76 | - * @throws InvalidArgumentException |
|
77 | - * @throws InvalidDataTypeException |
|
78 | - * @throws DomainException |
|
79 | - */ |
|
80 | - public function __construct( |
|
81 | - EE_Registry $registry, |
|
82 | - EE_Organization_Config $organization_config, |
|
83 | - EE_Core_Config $core_config, |
|
84 | - EE_Network_Core_Config $network_core_config, |
|
85 | - CountrySubRegionDao $countrySubRegionDao |
|
86 | - ) { |
|
87 | - $this->organization_config = $organization_config; |
|
88 | - $this->core_config = $core_config; |
|
89 | - $this->network_core_config = $network_core_config; |
|
90 | - $this->countrySubRegionDao = $countrySubRegionDao; |
|
91 | - parent::__construct( |
|
92 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
93 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
94 | - 'organization_settings', |
|
95 | - '', |
|
96 | - FormHandler::DO_NOT_SETUP_FORM, |
|
97 | - $registry |
|
98 | - ); |
|
99 | - } |
|
68 | + /** |
|
69 | + * Form constructor. |
|
70 | + * |
|
71 | + * @param EE_Registry $registry |
|
72 | + * @param EE_Organization_Config $organization_config |
|
73 | + * @param EE_Core_Config $core_config |
|
74 | + * @param EE_Network_Core_Config $network_core_config |
|
75 | + * @param CountrySubRegionDao $countrySubRegionDao |
|
76 | + * @throws InvalidArgumentException |
|
77 | + * @throws InvalidDataTypeException |
|
78 | + * @throws DomainException |
|
79 | + */ |
|
80 | + public function __construct( |
|
81 | + EE_Registry $registry, |
|
82 | + EE_Organization_Config $organization_config, |
|
83 | + EE_Core_Config $core_config, |
|
84 | + EE_Network_Core_Config $network_core_config, |
|
85 | + CountrySubRegionDao $countrySubRegionDao |
|
86 | + ) { |
|
87 | + $this->organization_config = $organization_config; |
|
88 | + $this->core_config = $core_config; |
|
89 | + $this->network_core_config = $network_core_config; |
|
90 | + $this->countrySubRegionDao = $countrySubRegionDao; |
|
91 | + parent::__construct( |
|
92 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
93 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
94 | + 'organization_settings', |
|
95 | + '', |
|
96 | + FormHandler::DO_NOT_SETUP_FORM, |
|
97 | + $registry |
|
98 | + ); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | |
102 | - /** |
|
103 | - * creates and returns the actual form |
|
104 | - * |
|
105 | - * @return EE_Form_Section_Proper |
|
106 | - * @throws EE_Error |
|
107 | - * @throws InvalidArgumentException |
|
108 | - * @throws InvalidDataTypeException |
|
109 | - * @throws InvalidInterfaceException |
|
110 | - * @throws ReflectionException |
|
111 | - */ |
|
112 | - public function generate() |
|
113 | - { |
|
114 | - $has_sub_regions = EEM_State::instance()->count( |
|
115 | - array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO)) |
|
116 | - ); |
|
117 | - $form = new EE_Form_Section_Proper( |
|
118 | - array( |
|
119 | - 'name' => 'organization_settings', |
|
120 | - 'html_id' => 'organization_settings', |
|
121 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
122 | - 'subsections' => array( |
|
123 | - 'contact_information_hdr' => new EE_Form_Section_HTML( |
|
124 | - EEH_HTML::h2( |
|
125 | - esc_html__('Contact Information', 'event_espresso') |
|
126 | - . ' ' |
|
127 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
|
128 | - '', |
|
129 | - 'contact-information-hdr' |
|
130 | - ) |
|
131 | - ), |
|
132 | - 'organization_name' => new EE_Text_Input( |
|
133 | - array( |
|
134 | - 'html_name' => 'organization_name', |
|
135 | - 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
|
136 | - 'html_help_text' => esc_html__( |
|
137 | - 'Displayed on all emails and invoices.', |
|
138 | - 'event_espresso' |
|
139 | - ), |
|
140 | - 'default' => $this->organization_config->get_pretty('name'), |
|
141 | - 'required' => false, |
|
142 | - ) |
|
143 | - ), |
|
144 | - 'organization_address_1' => new EE_Text_Input( |
|
145 | - array( |
|
146 | - 'html_name' => 'organization_address_1', |
|
147 | - 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
|
148 | - 'default' => $this->organization_config->get_pretty('address_1'), |
|
149 | - 'required' => false, |
|
150 | - ) |
|
151 | - ), |
|
152 | - 'organization_address_2' => new EE_Text_Input( |
|
153 | - array( |
|
154 | - 'html_name' => 'organization_address_2', |
|
155 | - 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
|
156 | - 'default' => $this->organization_config->get_pretty('address_2'), |
|
157 | - 'required' => false, |
|
158 | - ) |
|
159 | - ), |
|
160 | - 'organization_city' => new EE_Text_Input( |
|
161 | - array( |
|
162 | - 'html_name' => 'organization_city', |
|
163 | - 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
164 | - 'default' => $this->organization_config->get_pretty('city'), |
|
165 | - 'required' => false, |
|
166 | - ) |
|
167 | - ), |
|
168 | - 'organization_country' => new EE_Country_Select_Input( |
|
169 | - null, |
|
170 | - array( |
|
171 | - EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL, |
|
172 | - 'html_name' => 'organization_country', |
|
173 | - 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
174 | - 'default' => $this->organization_config->CNT_ISO, |
|
175 | - 'required' => false, |
|
176 | - 'html_help_text' => sprintf( |
|
177 | - esc_html__( |
|
178 | - '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s', |
|
179 | - 'event_espresso' |
|
180 | - ), |
|
181 | - '<span class="reminder-spn">', |
|
182 | - '</span>' |
|
183 | - ), |
|
184 | - ) |
|
185 | - ), |
|
186 | - 'organization_state' => new EE_State_Select_Input( |
|
187 | - null, |
|
188 | - array( |
|
189 | - 'html_name' => 'organization_state', |
|
190 | - 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
|
191 | - 'default' => $this->organization_config->STA_ID, |
|
192 | - 'required' => false, |
|
193 | - 'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions |
|
194 | - ? sprintf( |
|
195 | - esc_html__( |
|
196 | - 'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s', |
|
197 | - 'event_espresso' |
|
198 | - ), |
|
199 | - '<span class="reminder-spn">', |
|
200 | - '</span>', |
|
201 | - '<br />' |
|
202 | - ) |
|
203 | - : '', |
|
204 | - ) |
|
205 | - ), |
|
206 | - 'organization_zip' => new EE_Text_Input( |
|
207 | - array( |
|
208 | - 'html_name' => 'organization_zip', |
|
209 | - 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
|
210 | - 'default' => $this->organization_config->get_pretty('zip'), |
|
211 | - 'required' => false, |
|
212 | - ) |
|
213 | - ), |
|
214 | - 'organization_email' => new EE_Text_Input( |
|
215 | - array( |
|
216 | - 'html_name' => 'organization_email', |
|
217 | - 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
|
218 | - 'html_help_text' => sprintf( |
|
219 | - esc_html__( |
|
220 | - 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
|
221 | - 'event_espresso' |
|
222 | - ), |
|
223 | - '<code>[CO_FORMATTED_EMAIL]</code>', |
|
224 | - '<code>[CO_EMAIL]</code>' |
|
225 | - ), |
|
226 | - 'default' => $this->organization_config->get_pretty('email'), |
|
227 | - 'required' => false, |
|
228 | - ) |
|
229 | - ), |
|
230 | - 'organization_phone' => new EE_Text_Input( |
|
231 | - array( |
|
232 | - 'html_name' => 'organization_phone', |
|
233 | - 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
234 | - 'html_help_text' => esc_html__( |
|
235 | - 'The phone number for your organization.', |
|
236 | - 'event_espresso' |
|
237 | - ), |
|
238 | - 'default' => $this->organization_config->get_pretty('phone'), |
|
239 | - 'required' => false, |
|
240 | - ) |
|
241 | - ), |
|
242 | - 'organization_vat' => new EE_Text_Input( |
|
243 | - array( |
|
244 | - 'html_name' => 'organization_vat', |
|
245 | - 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
|
246 | - 'html_help_text' => esc_html__( |
|
247 | - 'The VAT/Tax Number may be displayed on invoices and receipts.', |
|
248 | - 'event_espresso' |
|
249 | - ), |
|
250 | - 'default' => $this->organization_config->get_pretty('vat'), |
|
251 | - 'required' => false, |
|
252 | - ) |
|
253 | - ), |
|
254 | - 'company_logo_hdr' => new EE_Form_Section_HTML( |
|
255 | - EEH_HTML::h2( |
|
256 | - esc_html__('Company Logo', 'event_espresso') |
|
257 | - . ' ' |
|
258 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
|
259 | - '', |
|
260 | - 'company-logo-hdr' |
|
261 | - ) |
|
262 | - ), |
|
263 | - 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
|
264 | - array( |
|
265 | - 'html_name' => 'organization_logo_url', |
|
266 | - 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
|
267 | - 'html_help_text' => esc_html__( |
|
268 | - 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
269 | - 'event_espresso' |
|
270 | - ), |
|
271 | - 'default' => $this->organization_config->get_pretty('logo_url'), |
|
272 | - 'required' => false, |
|
273 | - ) |
|
274 | - ), |
|
275 | - 'social_links_hdr' => new EE_Form_Section_HTML( |
|
276 | - EEH_HTML::h2( |
|
277 | - esc_html__('Social Links', 'event_espresso') |
|
278 | - . ' ' |
|
279 | - . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
|
280 | - . EEH_HTML::br() |
|
281 | - . EEH_HTML::p( |
|
282 | - esc_html__( |
|
283 | - 'Enter any links to social accounts for your organization here', |
|
284 | - 'event_espresso' |
|
285 | - ), |
|
286 | - '', |
|
287 | - 'description' |
|
288 | - ), |
|
289 | - '', |
|
290 | - 'social-links-hdr' |
|
291 | - ) |
|
292 | - ), |
|
293 | - 'organization_facebook' => new EE_Text_Input( |
|
294 | - array( |
|
295 | - 'html_name' => 'organization_facebook', |
|
296 | - 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
|
297 | - 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
|
298 | - 'default' => $this->organization_config->get_pretty('facebook'), |
|
299 | - 'required' => false, |
|
300 | - ) |
|
301 | - ), |
|
302 | - 'organization_twitter' => new EE_Text_Input( |
|
303 | - array( |
|
304 | - 'html_name' => 'organization_twitter', |
|
305 | - 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
|
306 | - 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
|
307 | - 'default' => $this->organization_config->get_pretty('twitter'), |
|
308 | - 'required' => false, |
|
309 | - ) |
|
310 | - ), |
|
311 | - 'organization_linkedin' => new EE_Text_Input( |
|
312 | - array( |
|
313 | - 'html_name' => 'organization_linkedin', |
|
314 | - 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
|
315 | - 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
|
316 | - 'default' => $this->organization_config->get_pretty('linkedin'), |
|
317 | - 'required' => false, |
|
318 | - ) |
|
319 | - ), |
|
320 | - 'organization_pinterest' => new EE_Text_Input( |
|
321 | - array( |
|
322 | - 'html_name' => 'organization_pinterest', |
|
323 | - 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
|
324 | - 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
|
325 | - 'default' => $this->organization_config->get_pretty('pinterest'), |
|
326 | - 'required' => false, |
|
327 | - ) |
|
328 | - ), |
|
329 | - 'organization_instagram' => new EE_Text_Input( |
|
330 | - array( |
|
331 | - 'html_name' => 'organization_instagram', |
|
332 | - 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
|
333 | - 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
|
334 | - 'default' => $this->organization_config->get_pretty('instagram'), |
|
335 | - 'required' => false, |
|
336 | - ) |
|
337 | - ), |
|
338 | - ), |
|
339 | - ) |
|
340 | - ); |
|
341 | - if (is_main_site()) { |
|
342 | - $form->add_subsections( |
|
343 | - array( |
|
344 | - 'site_license_key_hdr' => new EE_Form_Section_HTML( |
|
345 | - EEH_HTML::h2( |
|
346 | - esc_html__('Your Event Espresso License Key', 'event_espresso') |
|
347 | - . ' ' |
|
348 | - . EEH_HTML::span( |
|
349 | - EEH_Template::get_help_tab_link('site_license_key_info'), |
|
350 | - 'help_tour_activation' |
|
351 | - ), |
|
352 | - '', |
|
353 | - 'site-license-key-hdr' |
|
354 | - ) |
|
355 | - ), |
|
356 | - 'site_license_key' => $this->getSiteLicenseKeyField() |
|
357 | - ) |
|
358 | - ); |
|
359 | - $form->add_subsections( |
|
360 | - array( |
|
361 | - 'uxip_optin_hdr' => new EE_Form_Section_HTML( |
|
362 | - $this->uxipOptinText() |
|
363 | - ), |
|
364 | - 'ueip_optin' => new EE_Checkbox_Multi_Input( |
|
365 | - array( |
|
366 | - true => __('Yes! I want to help improve Event Espresso!', 'event_espresso') |
|
367 | - ), |
|
368 | - array( |
|
369 | - 'html_name' => EE_Core_Config::OPTION_NAME_UXIP, |
|
370 | - 'html_label_text' => esc_html__( |
|
371 | - 'UXIP Opt In?', |
|
372 | - 'event_espresso' |
|
373 | - ), |
|
374 | - 'default' => isset($this->core_config->ee_ueip_optin) |
|
375 | - ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN) |
|
376 | - : false, |
|
377 | - 'required' => false, |
|
378 | - ) |
|
379 | - ), |
|
380 | - ), |
|
381 | - 'organization_instagram', |
|
382 | - false |
|
383 | - ); |
|
384 | - } |
|
385 | - return $form; |
|
386 | - } |
|
102 | + /** |
|
103 | + * creates and returns the actual form |
|
104 | + * |
|
105 | + * @return EE_Form_Section_Proper |
|
106 | + * @throws EE_Error |
|
107 | + * @throws InvalidArgumentException |
|
108 | + * @throws InvalidDataTypeException |
|
109 | + * @throws InvalidInterfaceException |
|
110 | + * @throws ReflectionException |
|
111 | + */ |
|
112 | + public function generate() |
|
113 | + { |
|
114 | + $has_sub_regions = EEM_State::instance()->count( |
|
115 | + array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO)) |
|
116 | + ); |
|
117 | + $form = new EE_Form_Section_Proper( |
|
118 | + array( |
|
119 | + 'name' => 'organization_settings', |
|
120 | + 'html_id' => 'organization_settings', |
|
121 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
122 | + 'subsections' => array( |
|
123 | + 'contact_information_hdr' => new EE_Form_Section_HTML( |
|
124 | + EEH_HTML::h2( |
|
125 | + esc_html__('Contact Information', 'event_espresso') |
|
126 | + . ' ' |
|
127 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')), |
|
128 | + '', |
|
129 | + 'contact-information-hdr' |
|
130 | + ) |
|
131 | + ), |
|
132 | + 'organization_name' => new EE_Text_Input( |
|
133 | + array( |
|
134 | + 'html_name' => 'organization_name', |
|
135 | + 'html_label_text' => esc_html__('Organization Name', 'event_espresso'), |
|
136 | + 'html_help_text' => esc_html__( |
|
137 | + 'Displayed on all emails and invoices.', |
|
138 | + 'event_espresso' |
|
139 | + ), |
|
140 | + 'default' => $this->organization_config->get_pretty('name'), |
|
141 | + 'required' => false, |
|
142 | + ) |
|
143 | + ), |
|
144 | + 'organization_address_1' => new EE_Text_Input( |
|
145 | + array( |
|
146 | + 'html_name' => 'organization_address_1', |
|
147 | + 'html_label_text' => esc_html__('Street Address', 'event_espresso'), |
|
148 | + 'default' => $this->organization_config->get_pretty('address_1'), |
|
149 | + 'required' => false, |
|
150 | + ) |
|
151 | + ), |
|
152 | + 'organization_address_2' => new EE_Text_Input( |
|
153 | + array( |
|
154 | + 'html_name' => 'organization_address_2', |
|
155 | + 'html_label_text' => esc_html__('Street Address 2', 'event_espresso'), |
|
156 | + 'default' => $this->organization_config->get_pretty('address_2'), |
|
157 | + 'required' => false, |
|
158 | + ) |
|
159 | + ), |
|
160 | + 'organization_city' => new EE_Text_Input( |
|
161 | + array( |
|
162 | + 'html_name' => 'organization_city', |
|
163 | + 'html_label_text' => esc_html__('City', 'event_espresso'), |
|
164 | + 'default' => $this->organization_config->get_pretty('city'), |
|
165 | + 'required' => false, |
|
166 | + ) |
|
167 | + ), |
|
168 | + 'organization_country' => new EE_Country_Select_Input( |
|
169 | + null, |
|
170 | + array( |
|
171 | + EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL, |
|
172 | + 'html_name' => 'organization_country', |
|
173 | + 'html_label_text' => esc_html__('Country', 'event_espresso'), |
|
174 | + 'default' => $this->organization_config->CNT_ISO, |
|
175 | + 'required' => false, |
|
176 | + 'html_help_text' => sprintf( |
|
177 | + esc_html__( |
|
178 | + '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s', |
|
179 | + 'event_espresso' |
|
180 | + ), |
|
181 | + '<span class="reminder-spn">', |
|
182 | + '</span>' |
|
183 | + ), |
|
184 | + ) |
|
185 | + ), |
|
186 | + 'organization_state' => new EE_State_Select_Input( |
|
187 | + null, |
|
188 | + array( |
|
189 | + 'html_name' => 'organization_state', |
|
190 | + 'html_label_text' => esc_html__('State/Province', 'event_espresso'), |
|
191 | + 'default' => $this->organization_config->STA_ID, |
|
192 | + 'required' => false, |
|
193 | + 'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions |
|
194 | + ? sprintf( |
|
195 | + esc_html__( |
|
196 | + 'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s', |
|
197 | + 'event_espresso' |
|
198 | + ), |
|
199 | + '<span class="reminder-spn">', |
|
200 | + '</span>', |
|
201 | + '<br />' |
|
202 | + ) |
|
203 | + : '', |
|
204 | + ) |
|
205 | + ), |
|
206 | + 'organization_zip' => new EE_Text_Input( |
|
207 | + array( |
|
208 | + 'html_name' => 'organization_zip', |
|
209 | + 'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'), |
|
210 | + 'default' => $this->organization_config->get_pretty('zip'), |
|
211 | + 'required' => false, |
|
212 | + ) |
|
213 | + ), |
|
214 | + 'organization_email' => new EE_Text_Input( |
|
215 | + array( |
|
216 | + 'html_name' => 'organization_email', |
|
217 | + 'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'), |
|
218 | + 'html_help_text' => sprintf( |
|
219 | + esc_html__( |
|
220 | + 'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', |
|
221 | + 'event_espresso' |
|
222 | + ), |
|
223 | + '<code>[CO_FORMATTED_EMAIL]</code>', |
|
224 | + '<code>[CO_EMAIL]</code>' |
|
225 | + ), |
|
226 | + 'default' => $this->organization_config->get_pretty('email'), |
|
227 | + 'required' => false, |
|
228 | + ) |
|
229 | + ), |
|
230 | + 'organization_phone' => new EE_Text_Input( |
|
231 | + array( |
|
232 | + 'html_name' => 'organization_phone', |
|
233 | + 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
234 | + 'html_help_text' => esc_html__( |
|
235 | + 'The phone number for your organization.', |
|
236 | + 'event_espresso' |
|
237 | + ), |
|
238 | + 'default' => $this->organization_config->get_pretty('phone'), |
|
239 | + 'required' => false, |
|
240 | + ) |
|
241 | + ), |
|
242 | + 'organization_vat' => new EE_Text_Input( |
|
243 | + array( |
|
244 | + 'html_name' => 'organization_vat', |
|
245 | + 'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'), |
|
246 | + 'html_help_text' => esc_html__( |
|
247 | + 'The VAT/Tax Number may be displayed on invoices and receipts.', |
|
248 | + 'event_espresso' |
|
249 | + ), |
|
250 | + 'default' => $this->organization_config->get_pretty('vat'), |
|
251 | + 'required' => false, |
|
252 | + ) |
|
253 | + ), |
|
254 | + 'company_logo_hdr' => new EE_Form_Section_HTML( |
|
255 | + EEH_HTML::h2( |
|
256 | + esc_html__('Company Logo', 'event_espresso') |
|
257 | + . ' ' |
|
258 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')), |
|
259 | + '', |
|
260 | + 'company-logo-hdr' |
|
261 | + ) |
|
262 | + ), |
|
263 | + 'organization_logo_url' => new EE_Admin_File_Uploader_Input( |
|
264 | + array( |
|
265 | + 'html_name' => 'organization_logo_url', |
|
266 | + 'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'), |
|
267 | + 'html_help_text' => esc_html__( |
|
268 | + 'Your logo will be used on custom invoices, tickets, certificates, and payment templates.', |
|
269 | + 'event_espresso' |
|
270 | + ), |
|
271 | + 'default' => $this->organization_config->get_pretty('logo_url'), |
|
272 | + 'required' => false, |
|
273 | + ) |
|
274 | + ), |
|
275 | + 'social_links_hdr' => new EE_Form_Section_HTML( |
|
276 | + EEH_HTML::h2( |
|
277 | + esc_html__('Social Links', 'event_espresso') |
|
278 | + . ' ' |
|
279 | + . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info')) |
|
280 | + . EEH_HTML::br() |
|
281 | + . EEH_HTML::p( |
|
282 | + esc_html__( |
|
283 | + 'Enter any links to social accounts for your organization here', |
|
284 | + 'event_espresso' |
|
285 | + ), |
|
286 | + '', |
|
287 | + 'description' |
|
288 | + ), |
|
289 | + '', |
|
290 | + 'social-links-hdr' |
|
291 | + ) |
|
292 | + ), |
|
293 | + 'organization_facebook' => new EE_Text_Input( |
|
294 | + array( |
|
295 | + 'html_name' => 'organization_facebook', |
|
296 | + 'html_label_text' => esc_html__('Facebook', 'event_espresso'), |
|
297 | + 'other_html_attributes' => ' placeholder="facebook.com/profile.name"', |
|
298 | + 'default' => $this->organization_config->get_pretty('facebook'), |
|
299 | + 'required' => false, |
|
300 | + ) |
|
301 | + ), |
|
302 | + 'organization_twitter' => new EE_Text_Input( |
|
303 | + array( |
|
304 | + 'html_name' => 'organization_twitter', |
|
305 | + 'html_label_text' => esc_html__('Twitter', 'event_espresso'), |
|
306 | + 'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"', |
|
307 | + 'default' => $this->organization_config->get_pretty('twitter'), |
|
308 | + 'required' => false, |
|
309 | + ) |
|
310 | + ), |
|
311 | + 'organization_linkedin' => new EE_Text_Input( |
|
312 | + array( |
|
313 | + 'html_name' => 'organization_linkedin', |
|
314 | + 'html_label_text' => esc_html__('LinkedIn', 'event_espresso'), |
|
315 | + 'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"', |
|
316 | + 'default' => $this->organization_config->get_pretty('linkedin'), |
|
317 | + 'required' => false, |
|
318 | + ) |
|
319 | + ), |
|
320 | + 'organization_pinterest' => new EE_Text_Input( |
|
321 | + array( |
|
322 | + 'html_name' => 'organization_pinterest', |
|
323 | + 'html_label_text' => esc_html__('Pinterest', 'event_espresso'), |
|
324 | + 'other_html_attributes' => ' placeholder="pinterest.com/profilename"', |
|
325 | + 'default' => $this->organization_config->get_pretty('pinterest'), |
|
326 | + 'required' => false, |
|
327 | + ) |
|
328 | + ), |
|
329 | + 'organization_instagram' => new EE_Text_Input( |
|
330 | + array( |
|
331 | + 'html_name' => 'organization_instagram', |
|
332 | + 'html_label_text' => esc_html__('Instagram', 'event_espresso'), |
|
333 | + 'other_html_attributes' => ' placeholder="instagram.com/handle"', |
|
334 | + 'default' => $this->organization_config->get_pretty('instagram'), |
|
335 | + 'required' => false, |
|
336 | + ) |
|
337 | + ), |
|
338 | + ), |
|
339 | + ) |
|
340 | + ); |
|
341 | + if (is_main_site()) { |
|
342 | + $form->add_subsections( |
|
343 | + array( |
|
344 | + 'site_license_key_hdr' => new EE_Form_Section_HTML( |
|
345 | + EEH_HTML::h2( |
|
346 | + esc_html__('Your Event Espresso License Key', 'event_espresso') |
|
347 | + . ' ' |
|
348 | + . EEH_HTML::span( |
|
349 | + EEH_Template::get_help_tab_link('site_license_key_info'), |
|
350 | + 'help_tour_activation' |
|
351 | + ), |
|
352 | + '', |
|
353 | + 'site-license-key-hdr' |
|
354 | + ) |
|
355 | + ), |
|
356 | + 'site_license_key' => $this->getSiteLicenseKeyField() |
|
357 | + ) |
|
358 | + ); |
|
359 | + $form->add_subsections( |
|
360 | + array( |
|
361 | + 'uxip_optin_hdr' => new EE_Form_Section_HTML( |
|
362 | + $this->uxipOptinText() |
|
363 | + ), |
|
364 | + 'ueip_optin' => new EE_Checkbox_Multi_Input( |
|
365 | + array( |
|
366 | + true => __('Yes! I want to help improve Event Espresso!', 'event_espresso') |
|
367 | + ), |
|
368 | + array( |
|
369 | + 'html_name' => EE_Core_Config::OPTION_NAME_UXIP, |
|
370 | + 'html_label_text' => esc_html__( |
|
371 | + 'UXIP Opt In?', |
|
372 | + 'event_espresso' |
|
373 | + ), |
|
374 | + 'default' => isset($this->core_config->ee_ueip_optin) |
|
375 | + ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN) |
|
376 | + : false, |
|
377 | + 'required' => false, |
|
378 | + ) |
|
379 | + ), |
|
380 | + ), |
|
381 | + 'organization_instagram', |
|
382 | + false |
|
383 | + ); |
|
384 | + } |
|
385 | + return $form; |
|
386 | + } |
|
387 | 387 | |
388 | 388 | |
389 | - /** |
|
390 | - * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
391 | - * returns a string of HTML that can be directly echoed in a template |
|
392 | - * |
|
393 | - * @return string |
|
394 | - * @throws EE_Error |
|
395 | - * @throws InvalidArgumentException |
|
396 | - * @throws InvalidDataTypeException |
|
397 | - * @throws InvalidInterfaceException |
|
398 | - * @throws LogicException |
|
399 | - */ |
|
400 | - public function display() |
|
401 | - { |
|
402 | - $this->form()->enqueue_js(); |
|
403 | - return parent::display(); |
|
404 | - } |
|
389 | + /** |
|
390 | + * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
391 | + * returns a string of HTML that can be directly echoed in a template |
|
392 | + * |
|
393 | + * @return string |
|
394 | + * @throws EE_Error |
|
395 | + * @throws InvalidArgumentException |
|
396 | + * @throws InvalidDataTypeException |
|
397 | + * @throws InvalidInterfaceException |
|
398 | + * @throws LogicException |
|
399 | + */ |
|
400 | + public function display() |
|
401 | + { |
|
402 | + $this->form()->enqueue_js(); |
|
403 | + return parent::display(); |
|
404 | + } |
|
405 | 405 | |
406 | 406 | |
407 | - /** |
|
408 | - * handles processing the form submission |
|
409 | - * returns true or false depending on whether the form was processed successfully or not |
|
410 | - * |
|
411 | - * @param array $form_data |
|
412 | - * @return bool |
|
413 | - * @throws InvalidFormSubmissionException |
|
414 | - * @throws EE_Error |
|
415 | - * @throws LogicException |
|
416 | - * @throws InvalidArgumentException |
|
417 | - * @throws InvalidDataTypeException |
|
418 | - * @throws ReflectionException |
|
419 | - */ |
|
420 | - public function process($form_data = array()) |
|
421 | - { |
|
422 | - // process form |
|
423 | - $valid_data = (array) parent::process($form_data); |
|
424 | - if (empty($valid_data)) { |
|
425 | - return false; |
|
426 | - } |
|
407 | + /** |
|
408 | + * handles processing the form submission |
|
409 | + * returns true or false depending on whether the form was processed successfully or not |
|
410 | + * |
|
411 | + * @param array $form_data |
|
412 | + * @return bool |
|
413 | + * @throws InvalidFormSubmissionException |
|
414 | + * @throws EE_Error |
|
415 | + * @throws LogicException |
|
416 | + * @throws InvalidArgumentException |
|
417 | + * @throws InvalidDataTypeException |
|
418 | + * @throws ReflectionException |
|
419 | + */ |
|
420 | + public function process($form_data = array()) |
|
421 | + { |
|
422 | + // process form |
|
423 | + $valid_data = (array) parent::process($form_data); |
|
424 | + if (empty($valid_data)) { |
|
425 | + return false; |
|
426 | + } |
|
427 | 427 | |
428 | - if (is_main_site()) { |
|
429 | - $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key']) |
|
430 | - ? sanitize_text_field($form_data['ee_site_license_key']) |
|
431 | - : $this->network_core_config->site_license_key; |
|
432 | - } |
|
433 | - $this->organization_config->name = isset($form_data['organization_name']) |
|
434 | - ? sanitize_text_field($form_data['organization_name']) |
|
435 | - : $this->organization_config->name; |
|
436 | - $this->organization_config->address_1 = isset($form_data['organization_address_1']) |
|
437 | - ? sanitize_text_field($form_data['organization_address_1']) |
|
438 | - : $this->organization_config->address_1; |
|
439 | - $this->organization_config->address_2 = isset($form_data['organization_address_2']) |
|
440 | - ? sanitize_text_field($form_data['organization_address_2']) |
|
441 | - : $this->organization_config->address_2; |
|
442 | - $this->organization_config->city = isset($form_data['organization_city']) |
|
443 | - ? sanitize_text_field($form_data['organization_city']) |
|
444 | - : $this->organization_config->city; |
|
445 | - $this->organization_config->STA_ID = isset($form_data['organization_state']) |
|
446 | - ? absint($form_data['organization_state']) |
|
447 | - : $this->organization_config->STA_ID; |
|
448 | - $this->organization_config->CNT_ISO = isset($form_data['organization_country']) |
|
449 | - ? sanitize_text_field($form_data['organization_country']) |
|
450 | - : $this->organization_config->CNT_ISO; |
|
451 | - $this->organization_config->zip = isset($form_data['organization_zip']) |
|
452 | - ? sanitize_text_field($form_data['organization_zip']) |
|
453 | - : $this->organization_config->zip; |
|
454 | - $this->organization_config->email = isset($form_data['organization_email']) |
|
455 | - ? sanitize_email($form_data['organization_email']) |
|
456 | - : $this->organization_config->email; |
|
457 | - $this->organization_config->vat = isset($form_data['organization_vat']) |
|
458 | - ? sanitize_text_field($form_data['organization_vat']) |
|
459 | - : $this->organization_config->vat; |
|
460 | - $this->organization_config->phone = isset($form_data['organization_phone']) |
|
461 | - ? sanitize_text_field($form_data['organization_phone']) |
|
462 | - : $this->organization_config->phone; |
|
463 | - $this->organization_config->logo_url = isset($form_data['organization_logo_url']) |
|
464 | - ? esc_url_raw($form_data['organization_logo_url']) |
|
465 | - : $this->organization_config->logo_url; |
|
466 | - $this->organization_config->facebook = isset($form_data['organization_facebook']) |
|
467 | - ? esc_url_raw($form_data['organization_facebook']) |
|
468 | - : $this->organization_config->facebook; |
|
469 | - $this->organization_config->twitter = isset($form_data['organization_twitter']) |
|
470 | - ? esc_url_raw($form_data['organization_twitter']) |
|
471 | - : $this->organization_config->twitter; |
|
472 | - $this->organization_config->linkedin = isset($form_data['organization_linkedin']) |
|
473 | - ? esc_url_raw($form_data['organization_linkedin']) |
|
474 | - : $this->organization_config->linkedin; |
|
475 | - $this->organization_config->pinterest = isset($form_data['organization_pinterest']) |
|
476 | - ? esc_url_raw($form_data['organization_pinterest']) |
|
477 | - : $this->organization_config->pinterest; |
|
478 | - $this->organization_config->google = isset($form_data['organization_google']) |
|
479 | - ? esc_url_raw($form_data['organization_google']) |
|
480 | - : $this->organization_config->google; |
|
481 | - $this->organization_config->instagram = isset($form_data['organization_instagram']) |
|
482 | - ? esc_url_raw($form_data['organization_instagram']) |
|
483 | - : $this->organization_config->instagram; |
|
484 | - $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
485 | - ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
486 | - : false; |
|
487 | - $this->core_config->ee_ueip_has_notified = true; |
|
428 | + if (is_main_site()) { |
|
429 | + $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key']) |
|
430 | + ? sanitize_text_field($form_data['ee_site_license_key']) |
|
431 | + : $this->network_core_config->site_license_key; |
|
432 | + } |
|
433 | + $this->organization_config->name = isset($form_data['organization_name']) |
|
434 | + ? sanitize_text_field($form_data['organization_name']) |
|
435 | + : $this->organization_config->name; |
|
436 | + $this->organization_config->address_1 = isset($form_data['organization_address_1']) |
|
437 | + ? sanitize_text_field($form_data['organization_address_1']) |
|
438 | + : $this->organization_config->address_1; |
|
439 | + $this->organization_config->address_2 = isset($form_data['organization_address_2']) |
|
440 | + ? sanitize_text_field($form_data['organization_address_2']) |
|
441 | + : $this->organization_config->address_2; |
|
442 | + $this->organization_config->city = isset($form_data['organization_city']) |
|
443 | + ? sanitize_text_field($form_data['organization_city']) |
|
444 | + : $this->organization_config->city; |
|
445 | + $this->organization_config->STA_ID = isset($form_data['organization_state']) |
|
446 | + ? absint($form_data['organization_state']) |
|
447 | + : $this->organization_config->STA_ID; |
|
448 | + $this->organization_config->CNT_ISO = isset($form_data['organization_country']) |
|
449 | + ? sanitize_text_field($form_data['organization_country']) |
|
450 | + : $this->organization_config->CNT_ISO; |
|
451 | + $this->organization_config->zip = isset($form_data['organization_zip']) |
|
452 | + ? sanitize_text_field($form_data['organization_zip']) |
|
453 | + : $this->organization_config->zip; |
|
454 | + $this->organization_config->email = isset($form_data['organization_email']) |
|
455 | + ? sanitize_email($form_data['organization_email']) |
|
456 | + : $this->organization_config->email; |
|
457 | + $this->organization_config->vat = isset($form_data['organization_vat']) |
|
458 | + ? sanitize_text_field($form_data['organization_vat']) |
|
459 | + : $this->organization_config->vat; |
|
460 | + $this->organization_config->phone = isset($form_data['organization_phone']) |
|
461 | + ? sanitize_text_field($form_data['organization_phone']) |
|
462 | + : $this->organization_config->phone; |
|
463 | + $this->organization_config->logo_url = isset($form_data['organization_logo_url']) |
|
464 | + ? esc_url_raw($form_data['organization_logo_url']) |
|
465 | + : $this->organization_config->logo_url; |
|
466 | + $this->organization_config->facebook = isset($form_data['organization_facebook']) |
|
467 | + ? esc_url_raw($form_data['organization_facebook']) |
|
468 | + : $this->organization_config->facebook; |
|
469 | + $this->organization_config->twitter = isset($form_data['organization_twitter']) |
|
470 | + ? esc_url_raw($form_data['organization_twitter']) |
|
471 | + : $this->organization_config->twitter; |
|
472 | + $this->organization_config->linkedin = isset($form_data['organization_linkedin']) |
|
473 | + ? esc_url_raw($form_data['organization_linkedin']) |
|
474 | + : $this->organization_config->linkedin; |
|
475 | + $this->organization_config->pinterest = isset($form_data['organization_pinterest']) |
|
476 | + ? esc_url_raw($form_data['organization_pinterest']) |
|
477 | + : $this->organization_config->pinterest; |
|
478 | + $this->organization_config->google = isset($form_data['organization_google']) |
|
479 | + ? esc_url_raw($form_data['organization_google']) |
|
480 | + : $this->organization_config->google; |
|
481 | + $this->organization_config->instagram = isset($form_data['organization_instagram']) |
|
482 | + ? esc_url_raw($form_data['organization_instagram']) |
|
483 | + : $this->organization_config->instagram; |
|
484 | + $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0]) |
|
485 | + ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN) |
|
486 | + : false; |
|
487 | + $this->core_config->ee_ueip_has_notified = true; |
|
488 | 488 | |
489 | - $this->registry->CFG->currency = new EE_Currency_Config( |
|
490 | - $this->organization_config->CNT_ISO |
|
491 | - ); |
|
492 | - /** @var EE_Country $country */ |
|
493 | - $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO); |
|
494 | - if ($country instanceof EE_Country) { |
|
495 | - $country->set('CNT_active', 1); |
|
496 | - $country->save(); |
|
497 | - $this->countrySubRegionDao->saveCountrySubRegions($country); |
|
498 | - } |
|
499 | - return true; |
|
500 | - } |
|
489 | + $this->registry->CFG->currency = new EE_Currency_Config( |
|
490 | + $this->organization_config->CNT_ISO |
|
491 | + ); |
|
492 | + /** @var EE_Country $country */ |
|
493 | + $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO); |
|
494 | + if ($country instanceof EE_Country) { |
|
495 | + $country->set('CNT_active', 1); |
|
496 | + $country->save(); |
|
497 | + $this->countrySubRegionDao->saveCountrySubRegions($country); |
|
498 | + } |
|
499 | + return true; |
|
500 | + } |
|
501 | 501 | |
502 | 502 | |
503 | - /** |
|
504 | - * @return string |
|
505 | - */ |
|
506 | - private function uxipOptinText() |
|
507 | - { |
|
508 | - ob_start(); |
|
509 | - Stats::optinText(false); |
|
510 | - return ob_get_clean(); |
|
511 | - } |
|
503 | + /** |
|
504 | + * @return string |
|
505 | + */ |
|
506 | + private function uxipOptinText() |
|
507 | + { |
|
508 | + ob_start(); |
|
509 | + Stats::optinText(false); |
|
510 | + return ob_get_clean(); |
|
511 | + } |
|
512 | 512 | |
513 | 513 | |
514 | - /** |
|
515 | - * Return whether the site license key has been verified or not. |
|
516 | - * @return bool |
|
517 | - */ |
|
518 | - private function licenseKeyVerified() |
|
519 | - { |
|
520 | - if (empty($this->network_core_config->site_license_key)) { |
|
521 | - return false; |
|
522 | - } |
|
523 | - $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
524 | - $verify_fail = get_option($ver_option_key, false); |
|
525 | - return $verify_fail === false |
|
526 | - || (! empty($this->network_core_config->site_license_key) |
|
527 | - && $verify_fail === false |
|
528 | - ); |
|
529 | - } |
|
514 | + /** |
|
515 | + * Return whether the site license key has been verified or not. |
|
516 | + * @return bool |
|
517 | + */ |
|
518 | + private function licenseKeyVerified() |
|
519 | + { |
|
520 | + if (empty($this->network_core_config->site_license_key)) { |
|
521 | + return false; |
|
522 | + } |
|
523 | + $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
524 | + $verify_fail = get_option($ver_option_key, false); |
|
525 | + return $verify_fail === false |
|
526 | + || (! empty($this->network_core_config->site_license_key) |
|
527 | + && $verify_fail === false |
|
528 | + ); |
|
529 | + } |
|
530 | 530 | |
531 | 531 | |
532 | - /** |
|
533 | - * @return EE_Text_Input |
|
534 | - */ |
|
535 | - private function getSiteLicenseKeyField() |
|
536 | - { |
|
537 | - $text_input = new EE_Text_Input( |
|
538 | - array( |
|
539 | - 'html_name' => 'ee_site_license_key', |
|
540 | - 'html_id' => 'site_license_key', |
|
541 | - 'html_label_text' => esc_html__('Support License Key', 'event_espresso'), |
|
542 | - /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */ |
|
543 | - 'html_help_text' => sprintf( |
|
544 | - esc_html__( |
|
545 | - 'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', |
|
546 | - 'event_espresso' |
|
547 | - ), |
|
548 | - '<strong>', |
|
549 | - '</strong>' |
|
550 | - ), |
|
551 | - /** phpcs:enable */ |
|
552 | - 'default' => isset($this->network_core_config->site_license_key) |
|
553 | - ? $this->network_core_config->site_license_key |
|
554 | - : '', |
|
555 | - 'required' => false, |
|
556 | - 'form_html_filter' => new VsprintfFilter( |
|
557 | - '%2$s %1$s', |
|
558 | - array($this->getValidationIndicator()) |
|
559 | - ) |
|
560 | - ) |
|
561 | - ); |
|
562 | - return $text_input; |
|
563 | - } |
|
532 | + /** |
|
533 | + * @return EE_Text_Input |
|
534 | + */ |
|
535 | + private function getSiteLicenseKeyField() |
|
536 | + { |
|
537 | + $text_input = new EE_Text_Input( |
|
538 | + array( |
|
539 | + 'html_name' => 'ee_site_license_key', |
|
540 | + 'html_id' => 'site_license_key', |
|
541 | + 'html_label_text' => esc_html__('Support License Key', 'event_espresso'), |
|
542 | + /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */ |
|
543 | + 'html_help_text' => sprintf( |
|
544 | + esc_html__( |
|
545 | + 'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', |
|
546 | + 'event_espresso' |
|
547 | + ), |
|
548 | + '<strong>', |
|
549 | + '</strong>' |
|
550 | + ), |
|
551 | + /** phpcs:enable */ |
|
552 | + 'default' => isset($this->network_core_config->site_license_key) |
|
553 | + ? $this->network_core_config->site_license_key |
|
554 | + : '', |
|
555 | + 'required' => false, |
|
556 | + 'form_html_filter' => new VsprintfFilter( |
|
557 | + '%2$s %1$s', |
|
558 | + array($this->getValidationIndicator()) |
|
559 | + ) |
|
560 | + ) |
|
561 | + ); |
|
562 | + return $text_input; |
|
563 | + } |
|
564 | 564 | |
565 | 565 | |
566 | - /** |
|
567 | - * @return string |
|
568 | - */ |
|
569 | - private function getValidationIndicator() |
|
570 | - { |
|
571 | - $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red'; |
|
572 | - return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>'; |
|
573 | - } |
|
566 | + /** |
|
567 | + * @return string |
|
568 | + */ |
|
569 | + private function getValidationIndicator() |
|
570 | + { |
|
571 | + $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red'; |
|
572 | + return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>'; |
|
573 | + } |
|
574 | 574 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.80.rc.013'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.80.rc.013'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |