/** * Return the custom subdomain from the cloud or null if the subdomain could not be retrieved */ public static function get_subdomain_form_cloud() { return CC_Cloud_Subdomain::load_from_cloud(); }
public function sanitize($options) { $clean = true; CC_Log::write('########## SANITZE OPTIONS FOR MAIN SETTINGS :: ' . get_class() . ' ########## ' . print_r($options, true)); // Attempt to sanitize, validate, and save the options if (is_array($options)) { foreach ($options as $key => $value) { if ('secret_key' == $key) { if (cc_starts_with($value, 's_')) { // Attempt to get the subdomain from the cloud and save it locally $subdomain = CC_Cloud_Subdomain::load_from_cloud($value); if (isset($subdomain)) { $options['subdomain'] = $subdomain; } } else { $clean = false; $error_message = __('The secret key is invalid', 'cart66'); add_settings_error('cart66_main_settings_group', 'invalid-secret-key', $error_message, 'error'); CC_Log::write("Cart66 settings validation error added: {$error_message}"); } } } } else { $message = __('Cart66 settings were not saved', 'cart66'); add_settings_error('cart66_main_settings_group', 'settings-valid', $message, 'error'); } // Sanitize options registered by add-on plugins $options = apply_filters('cart66_main_settings_sanitize', $options); /* if( true == self::$is_valid ) { $message = __( 'Cart66 settings saved', 'cart66' ); add_settings_error( 'cart66_main_settings_group', 'settings-valid', $message, 'updated' ); } */ return $options; }