@@ -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 | } |