/** * @singleton method used to instantiate class object * @access public * @return EE_Network_Config instance */ public static function instance() { // check if class object is instantiated, and instantiated properly if (self::$_instance === NULL or !is_object(self::$_instance) or !self::$_instance instanceof EE_Network_Config) { self::$_instance = new self(); } return self::$_instance; }
private function _handle_org_option($option_name, $value) { $c = EE_Config::instance(); $cn = EE_Network_Config::instance(); switch ($option_name) { case 'organization': $c->organization->name = $value; break; case 'organization_street1': $c->organization->address_1 = $value; break; case 'organization_street2': $c->organization->address_2 = $value; break; case 'organization_city': $c->organization->city = $value; break; case 'organization_state': try { $state = $this->get_migration_script()->get_or_create_state($value); $state_id = $state['STA_ID']; $c->organization->STA_ID = $state_id; } catch (EE_Error $e) { } break; case 'organization_zip': $c->organization->zip = $value; break; case 'contact_email': $c->organization->email = $value; break; case 'default_payment_status': $c->registration->default_STS_ID = $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID($value); break; case 'organization_country': $iso = $this->get_migration_script()->get_iso_from_3_1_country_id($value); $c->organization->CNT_ISO = $iso; $country_row = $this->get_migration_script()->get_or_create_country($iso); if (!$country_row) { $this->add_error(sprintf(__("Could not set country's currency config because no country exists for ISO %s", "event_espresso"), $iso)); } //can't use EE_Currency_Config's handy constructor because the models are off-limits right now (and it uses them) $c->currency->code = $country_row['CNT_cur_code']; // currency code: USD, CAD, EUR $c->currency->name = $country_row['CNT_cur_single']; // Dollar $c->currency->plural = $country_row['CNT_cur_plural']; // Dollars $c->currency->sign = $country_row['CNT_cur_sign']; // currency sign: $ $c->currency->sign_b4 = intval($country_row['CNT_cur_sign_b4']); // currency sign before or after: $TRUE or FALSE$ $c->currency->dec_plc = intval($country_row['CNT_cur_dec_plc']); // decimal places: 2 = 0.00 3 = 0.000 $c->currency->dec_mrk = $country_row['CNT_cur_dec_mrk']; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 $c->currency->thsnds = $country_row['CNT_cur_thsnds']; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 // $c->currency = new EE_Currency_Config($c->organization->CNT_ISO);break; // case 'currency_symbol': ignore the currency symbol. we'll just go by their country. // $c->currency->sign = $value;break; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 // $c->currency = new EE_Currency_Config($c->organization->CNT_ISO);break; // case 'currency_symbol': ignore the currency symbol. we'll just go by their country. // $c->currency->sign = $value;break; case 'show_pending_payment_options': $c->registration->show_pending_payment_options = $value == 'Y'; break; case 'display_address_in_regform': $c->template_settings->display_address_in_regform = $value == 'Y'; break; case 'default_logo_url': $c->organization->logo_url = $value; break; case 'event_page_id': //also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS //to ESPRESSO_THANK_YOU $reg_page_post = get_post($value); $reg_page_post->post_content = str_replace("[ESPRESSO_EVENTS]", "[ESPRESSO_CHECKOUT]", $reg_page_post->post_content); wp_update_post($reg_page_post); $c->core->reg_page_id = $value; break; case 'return_url': //also, find that post, and changes the shortcode in it from ESPRESSO_PAYMENTS //to ESPRESSO_THANK_YOU $thank_you_page_post = get_post($value); $thank_you_page_post->post_content = str_replace("[ESPRESSO_PAYMENTS]", "[ESPRESSO_THANK_YOU]", $thank_you_page_post->post_content); wp_update_post($thank_you_page_post); $c->core->thank_you_page_id = $value; break; case 'cancel_return': $c->core->cancel_page_id = $value; break; case 'notify_url': $c->core->txn_page_id = $value; break; case 'use_captcha': $c->registration->use_captcha = $value == 'Y'; break; case 'recaptcha_publickey': $c->registration->recaptcha_publickey = $value; break; case 'recaptcha_privatekey': $c->registration->recaptcha_privatekey = $value; break; case 'recaptcha_theme': $c->registration->recaptcha_theme = $value; break; case 'recaptcha_width': $c->registration->recaptcha_width = $value; break; case 'recaptcha_language': $c->registration->recaptcha_language = $value; break; case 'espresso_dashboard_widget': $c->admin->use_dashboard_widget = $value == 'Y'; break; case 'use_personnel_manager': $c->admin->use_personnel_manager = $value == 'Y'; break; case 'use_event_timezones': $c->admin->use_event_timezones = $value == 'Y'; break; case 'full_logging': $c->admin->use_full_logging = $value == 'Y'; break; case 'affiliate_id': $c->admin->affiliate_id = $value; break; case 'site_license_key': $cn->core->site_license_key = $value; break; default: do_action('AHEE__EE_DMS_4_1_0__handle_org_option', $option_name, $value); } }
/** * updates espresso configuration settings * * @access protected * @param string $tab * @param array $data * @param string $file file where error occurred * @param string $func function where error occurred * @param string $line line no where error occurred * @return boolean */ protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { //remove any options that are NOT going to be saved with the config settings. if (isset($config->core->ee_ueip_optin)) { $config->core->ee_ueip_has_notified = TRUE; // TODO: remove the following two lines and make sure values are migrated from 3.1 update_option('ee_ueip_optin', $config->core->ee_ueip_optin); update_option('ee_ueip_has_notified', TRUE); } // and save it (note we're also doing the network save here) $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); if ($config_saved && $net_saved) { EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); return TRUE; } else { EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); return FALSE; } }