/// <summary> /// Gets avatar type and initializes control's Avatar/Gravatar/User choice mode (depends on site and user's settings). /// </summary> /// <returns>Avatar type.</returns> private string GetAvatarType() { // Load avatar settings string avatarType = DataHelper.GetNotEmpty(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSAvatarType"), AvatarInfoProvider.AVATAR); if (avatarType == AvatarInfoProvider.USERCHOICE) { rdbMode.Visible = (EditedUser != null); // First request if (!URLHelper.IsPostback() || String.IsNullOrEmpty(rdbMode.SelectedValue)) { avatarType = (EditedUser != null) ? EditedUser.UserSettings.UserAvatarType : AvatarInfoProvider.AVATAR; // Set selector on first request rdbMode.SelectedValue = avatarType; } else { // Get type from selector on postback avatarType = rdbMode.SelectedValue; } } else { rdbMode.SelectedValue = avatarType; } return(avatarType); }
protected void Page_Load(object sender, EventArgs e) { // Set trimming ability from form controls parameters Trim = ValidationHelper.GetBoolean(GetValue("trim"), false); CheckMinMaxLength = true; CheckRegularExpression = true; string watermark = null; // Get default value if (!String.IsNullOrEmpty(WatermarkValueKey)) { switch (WatermarkValueSourceType) { // Get value from settings case ValueSourceType.Settings: watermark = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + "." + WatermarkValueKey); break; // Get value from resource strings case ValueSourceType.ResourceString: watermark = ResHelper.GetString(WatermarkValueKey); break; } } // Set default value as watermark if (!String.IsNullOrEmpty(watermark)) { txtValue.WatermarkText = watermark; } }
/// <summary> /// Get the Node Item Builder Settings based on the given NodeAliasPath, should be used for individual page updates as will limit what is checked based on the page. /// </summary> /// <param name="NodeAliasPath">The Node Alias Path</param> /// <param name="SiteName"></param> /// <param name="CheckingForUpdates"></param> /// <param name="CheckEntireTree"></param> /// <returns>The node item builder setting</returns> private static NodeItemBuilderSettings GetNodeItemBuilderSettings(string NodeAliasPath, string SiteName, bool CheckingForUpdates, bool CheckEntireTree) { return(CacheHelper.Cache(cs => { if (cs.Cached) { cs.CacheDependency = CacheHelper.GetCacheDependency(new string[] { "cms.site|byname|" + SiteName, "cms.siteculture|all", "cms.settingskey|byname|CMSDefaultCultureCode", "cms.settingskey|byname|GenerateCultureVariationUrlSlugs", "cms.class|all" }); } // Loop through Cultures and start rebuilding pages SiteInfo Site = SiteInfoProvider.GetSiteInfo(SiteName); string DefaultCulture = SettingsKeyInfoProvider.GetValue("CMSDefaultCultureCode", new SiteInfoIdentifier(SiteName)); bool GenerateCultureVariationUrlSlugs = SettingsKeyInfoProvider.GetBoolValue("GenerateCultureVariationUrlSlugs", new SiteInfoIdentifier(SiteName)); var BaseMacroResolver = MacroResolver.GetInstance(true); BaseMacroResolver.AddAnonymousSourceData(new object[] { Site }); // Now build URL slugs for the default language always. List <string> Cultures = CultureSiteInfoProvider.GetSiteCultureCodes(SiteName); // Configure relational checks based on node bool BuildSiblings = CheckSiblings(NodeAliasPath, SiteName); bool BuildDescendents = CheckDescendents(NodeAliasPath, SiteName); bool BuildChildren = CheckChildren(NodeAliasPath, SiteName); return new NodeItemBuilderSettings(Cultures, DefaultCulture, GenerateCultureVariationUrlSlugs, BaseMacroResolver, CheckingForUpdates, CheckEntireTree, BuildSiblings, BuildChildren, BuildDescendents, SiteName); }, new CacheSettings(1440, "GetNodeItemBuilderSettings", NodeAliasPath, SiteName, CheckingForUpdates, CheckEntireTree))); }
/// <summary> /// Returns the allowed extensions with hash. /// </summary> private string GetAllowedExtensions() { string filter; if (String.IsNullOrEmpty(AllowedExtensions)) { if (MediaLibraryID > 0) { filter = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSMediaFileAllowedExtensions"); } else { filter = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSUploadExtensions"); } } else { filter = AllowedExtensions; } if (!string.IsNullOrEmpty(filter)) { // Append hash to list of allowed extensions string hash = ValidationHelper.GetHashString(filter, new HashSettings { UserSpecific = false }); filter = String.Format("{0}{1}Hash{1}{2}", filter, PARAMETER_SEPARATOR, hash); } return(filter); }
/// <summary> /// Called automatically after the related payment provider is assigned to the form and initialized. /// </summary> protected override void OnInitialized() { // Attempts to get a default email address value from the Kentico customer object string currentUrl = HttpContext.Current.Request.Url.AbsoluteUri.ToString(); if (currentUrl.Contains("novalnet_error_message=")) { string[] parts = currentUrl.Split(new char[] { '?', '&' }); lblError.Text = Server.UrlDecode(parts[2].Replace("novalnet_error_message=", "")); lblError.Visible = true; } else { string shopTestMode = SettingsKeyInfoProvider.GetValue("test_mode"); if (shopTestMode == "True") { string testModeText = ResHelper.GetString("custom.testmode_notification"); testmode.Visible = true; testmode.Text = testModeText; } string localizedResult = ResHelper.GetString("custom.payment_description"); nnDescription.Text = localizedResult; } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (this.StopProcessing) { // Do not process } else { using (WebClient webClient = new WebClient()) { webClient.Headers[HttpRequestHeader.ContentType] = "application/json"; webClient.Headers.Add("x-rapidapi-host", SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".WorldIndiaXRapidAPIHost")); webClient.Headers.Add("x-rapidapi-key", SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".XRapidAPIKey")); var response = webClient.DownloadString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CVWIAPI")); var countrywiseData = JsonConvert.DeserializeObject <WorldDataCountryWise>(response); List <WorldData> worldDataList = new List <WorldData>(); if (countrywiseData.World_Total != null) { WorldData wd = new WorldData() { Total_Cases = countrywiseData.World_Total.Total_Cases, Total_Deaths = countrywiseData.World_Total.Total_Deaths, Total_Recovered = countrywiseData.World_Total.Total_Recovered, New_Cases = countrywiseData.World_Total.New_Cases, New_Deaths = countrywiseData.World_Total.New_Deaths, Statistic_Taken_At = countrywiseData.World_Total.Statistic_Taken_At }; worldDataList.Add(wd); } brWorldData.DataSource = GetWorldData(worldDataList); brWorldData.ItemTemplate = TransformationHelper.LoadTransformation(brWorldData, TransformationForWorldData); List <Countries> allCountriesData = new List <Countries>(); if (countrywiseData.Countries_Stat.Count > 0) { foreach (var c in countrywiseData.Countries_Stat) { Countries countryInfo = new Countries() { Country_Name = c.Country_Name, Cases = c.Cases, Deaths = c.Deaths, Region = c.Region, Total_Recovered = c.Total_Recovered, New_Deaths = c.New_Deaths, New_Cases = c.New_Cases, Serious_Critical = c.Serious_Critical, Active_Cases = c.Active_Cases, Deaths_Per_1m_Population = c.Deaths_Per_1m_Population, Total_Tests = c.Total_Tests, Total_Cases_Per_1m_Population = c.Total_Cases_Per_1m_Population, Tests_Per_1m_Population = c.Tests_Per_1m_Population }; allCountriesData.Add(countryInfo); } } brCountryWiseData.DataSource = GetCountryWiseData(allCountriesData); brCountryWiseData.ItemTemplate = TransformationHelper.LoadTransformation(brCountryWiseData, TransformationForCountryWise); } } }
public List <Breadcrumb> GetBreadcrumbs(int PageIdentifier, bool IncludeDefaultBreadcrumb = true) { string[] ValidClassNames = SettingsKeyInfoProvider.GetValue(new SettingsKeyName("BreadcrumbPageTypes", new SiteInfoIdentifier(SiteContext.CurrentSiteID))).ToLower().Split(";,|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); List <Breadcrumb> Breadcrumbs = new List <Breadcrumb>(); // Get the current Page and then loop through ancestors var Page = _Helper.GetBreadcrumbNode(PageIdentifier); bool IsCurrentPage = true; while (Page != null && !Page.ClassName.Equals("CMS.Root", StringComparison.InvariantCultureIgnoreCase)) { if (ValidClassNames.Length == 0 || ValidClassNames.Contains(Page.ClassName.ToLower())) { Breadcrumbs.Add(_Helper.PageToBreadcrumb(Page, IsCurrentPage)); } Page = _Helper.GetBreadcrumbNode(Page.NodeParentID); IsCurrentPage = false; } // Add given Top Level Breadcrumb if provided if (IncludeDefaultBreadcrumb) { Breadcrumbs.Add(DependencyResolver.Current.GetService <IBreadcrumbRepository>().GetDefaultBreadcrumb()); } // Reverse breadcrumb order Breadcrumbs.Reverse(); return(Breadcrumbs); }
/// <summary> /// Indicates if there is needed fallback to root document. /// </summary> /// <param name="selectedNode">Selected node</param> private bool UseFallbackToRoot(TreeNode selectedNode) { if (selectedNode != null) { bool useFallback = false; string currentAliasPath = selectedNode.NodeAliasPath; // Check user's starting path string userStartingPath = CurrentUser.UserStartingAliasPath; if (!String.IsNullOrEmpty(userStartingPath)) { useFallback = !currentAliasPath.StartsWithCSafe(userStartingPath, true) && (TreePathUtils.GetNodeIdByAliasPath(selectedNode.NodeSiteName, userStartingPath) > 0); } if (IsProductTree) { // Check products starting path if in Products UI string productsStartingPath = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSStoreProductsStartingPath"); if (!String.IsNullOrEmpty(productsStartingPath)) { useFallback |= !currentAliasPath.StartsWithCSafe(productsStartingPath, true) && (TreePathUtils.GetNodeIdByAliasPath(selectedNode.NodeSiteName, productsStartingPath) > 0); } } return(useFallback); } return(true); }
/// <summary> /// Gets formatted string with name and value of given keys for a specified site. /// If site name is not specified, global settings are retrieved. /// </summary> /// <param name="keys">Keys</param> /// <param name="siteName">Site name</param> private string FormatKeys(IEnumerable <SettingsKeyInfo> keys, string siteName) { var sb = new StringBuilder(""); foreach (var key in keys) { // Append key display name var displayName = ResHelper.LocalizeString(key.KeyDisplayName); sb.Append(displayName + (displayName.EndsWithCSafe(":") ? " " : ": ")); // Append value var value = SettingsKeyInfoProvider.GetValue(key.KeyName, siteName); sb.Append(value); // Append extra information if required var isValueInherited = SettingsKeyInfoProvider.IsValueInherited(key.KeyName, siteName); if (isValueInherited) { sb.Append(" (inherited)"); } if (key.KeyIsCustom) { sb.Append(" (custom)"); } sb.AppendLine(); sb.AppendLine(); } return(sb.ToString()); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (this.StopProcessing) { // Do not process } else { if (Request.QueryString["ID"] != null) { btnSave.Click += btnSave_Edit; categoyId = ValidationHelper.GetInteger(Request.QueryString["ID"], 0); SetFeild(categoyId); } else { btnSave.Click += btnSave_Save; } BindStatus(); txtName.Attributes.Add("PlaceHolder", ResHelper.GetString("Kadena.Categoryform.NameWatermark")); txtDescription.Attributes.Add("PlaceHolder", ResHelper.GetString("Kadena.Categoryform.DesWatermark")); rfvUserNameRequired.ErrorMessage = ResHelper.GetString("Kadena.Categoryform.NameValidation"); revDescription.ErrorMessage = ResHelper.GetString("Kadena.Categoryform.DesValidation"); revName.ErrorMessage = ResHelper.GetString("Kadena.Categoryform.NameRangeValidation"); folderpath = SettingsKeyInfoProvider.GetValue("KDA_CategoryFolderPath", CurrentSiteName); } }
private void SetUserPicture() { if (BlogProperties.EnableUserPictures) { userPict.UserID = Comment.CommentUserID; userPict.Width = BlogProperties.UserPictureMaxWidth; userPict.Height = BlogProperties.UserPictureMaxHeight; userPict.Visible = true; userPict.RenderOuterDiv = true; userPict.OuterDivCSSClass = "CommentUserPicture"; // Gravatar support string avType = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSAvatarType"); if (avType == AvatarInfoProvider.USERCHOICE) { UserInfo ui = UserInfoProvider.GetUserInfo(Comment.CommentUserID); avType = ui != null ? ui.UserSettings.UserAvatarType : AvatarInfoProvider.GRAVATAR; } userPict.UserEmail = Comment.CommentEmail; userPict.UserAvatarType = avType; } else { userPict.Visible = false; } }
/// <summary> /// Runs the update procedure. /// </summary> public static void Update() { if (DatabaseHelper.IsDatabaseAvailable && SystemContext.IsCMSRunningAsMainApplication) { try { string version = SettingsKeyInfoProvider.GetValue("CMSDataVersion"); switch (version.ToLowerInvariant()) { case "11.0": using (var context = new CMSActionContext()) { context.LogLicenseWarnings = false; UpgradeApplication(Upgrade110To120, "12.0", "Upgrade_110_120.zip"); } break; } } catch (Exception ex) { EventLogProvider.LogException(EventLogSource, "UPGRADE", ex); } } }
private void SetupShoppingCartPreview() { lnkShoppingCart.NavigateUrl = URLHelper.ResolveUrl(ECommerceSettings.ShoppingCartURL(SiteContext.CurrentSiteID)); lnkMyAccount.NavigateUrl = URLHelper.ResolveUrl(SettingsKeyInfoProvider.GetValue("CMSMyAccountURL", SiteContext.CurrentSiteID)); lnkMyWishList.NavigateUrl = URLHelper.ResolveUrl(ECommerceSettings.WishListURL(SiteContext.CurrentSiteID)); lblPrice.Text = ECommerceContext.CurrentShoppingCart.GetFormattedPrice(ECommerceContext.CurrentShoppingCart.TotalPrice); }
/// <summary> /// Generates a new JWT encryption key and stores it in <see cref="ValidationHelper.CMS_SETTINGS_JWT_TOKEN_ENCRYPTION_KEY"/> settings key. /// </summary> private static void SetJWTEncryptionKey() { if (string.IsNullOrWhiteSpace(SettingsKeyInfoProvider.GetValue(ValidationHelper.CMS_SETTINGS_JWT_TOKEN_ENCRYPTION_KEY))) { var generatedSecret = Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 16); SettingsKeyInfoProvider.SetGlobalValue(ValidationHelper.CMS_SETTINGS_JWT_TOKEN_ENCRYPTION_KEY, generatedSecret, false); } }
public void RaiseCallbackEvent(string eventArgument) { // Get site settings extensions = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSUploadExtensions"); // Returns site settings back to the client extensions = string.Format("{0}|{1}", extensions, eventArgument); }
public decimal GetUSPSRate(Rates objRates, CurrentUserInfo uinfo, Delivery delivery, string strShippingOptionName) { decimal decRate = 0; try { // Cache the data for 10 minutes with a key using (CachedSection <Rates> cs = new CachedSection <Rates>(ref objRates, 60, true, null, "USPS-" + uinfo.UserID + "-" + delivery.DeliveryAddress.AddressZip + "-" + ValidationHelper.GetString(delivery.Weight, ""))) { if (cs.LoadData) { //Get real-time shipping rates from USPS using dotNETShip Ship objShip = new Ship(); objShip.USPSLogin = strUSPSLogin; objShip.OrigZipPostal = SettingsKeyInfoProvider.GetValue("SourceZip", "90001"); string[] strCountryState = SettingsKeyInfoProvider.GetValue("SourceCountryState", "US").Split(';'); CountryInfo ci = CountryInfoProvider.GetCountryInfo(ValidationHelper.GetString(strCountryState[0], "USA")); objShip.OrigCountry = ci.CountryTwoLetterCode; StateInfo si = StateInfoProvider.GetStateInfo(ValidationHelper.GetString(strCountryState[1], "California")); objShip.OrigStateProvince = si.StateCode; objShip.DestZipPostal = delivery.DeliveryAddress.AddressZip; objShip.DestCountry = delivery.DeliveryAddress.GetCountryTwoLetterCode(); objShip.DestStateProvince = delivery.DeliveryAddress.GetStateCode(); objShip.Length = 12; objShip.Width = 12; objShip.Height = 12; objShip.Weight = (float)delivery.Weight; objShip.Rate("USPS"); cs.Data = objShip.Rates; } objRates = cs.Data; } foreach (Rate rate in objRates) { if (rate.Name.ToLower() == strShippingOptionName.ToLower()) { decRate = ValidationHelper.GetDecimal(rate.Charge, 0); break; } } } catch (Exception ex) { //Log the error EventLogProvider.LogException("MultiCarrier - GetUSPSRate", "EXCEPTION", ex); //Set some base rate for the shipping decRate = 10; } return(decRate); }
public static string GetSettingValue(string settingKey) { if (string.IsNullOrWhiteSpace(settingKey)) { return(string.Empty); } return(SettingsKeyInfoProvider.GetValue($"{SiteContext.CurrentSiteName}.{settingKey}")); }
protected void InitializeProperties() { string autoresize = ValidationHelper.GetString(FieldInfo.Settings["autoresize"], "").ToLowerCSafe(); // Set custom settings if (autoresize == "custom") { if (FieldInfo.Settings["autoresize_width"] != null) { ResizeToWidth = ValidationHelper.GetInteger(FieldInfo.Settings["autoresize_width"], 0); } if (FieldInfo.Settings["autoresize_height"] != null) { ResizeToHeight = ValidationHelper.GetInteger(FieldInfo.Settings["autoresize_height"], 0); } if (FieldInfo.Settings["autoresize_maxsidesize"] != null) { ResizeToMaxSideSize = ValidationHelper.GetInteger(FieldInfo.Settings["autoresize_maxsidesize"], 0); } } // Set site settings else if (autoresize == "") { string siteName = SiteContext.CurrentSiteName; ResizeToWidth = ImageHelper.GetAutoResizeToWidth(siteName); ResizeToHeight = ImageHelper.GetAutoResizeToHeight(siteName); ResizeToMaxSideSize = ImageHelper.GetAutoResizeToMaxSideSize(siteName); } if (UseFileUploader) { string siteName = SiteContext.CurrentSiteName; string siteExtensions = SettingsKeyInfoProvider.GetValue(siteName + ".CMSUploadExtensions"); string allExtensions = siteExtensions; string customExtensions = ValidationHelper.GetString(FieldInfo.Settings["allowed_extensions"], ""); if (!string.IsNullOrEmpty(customExtensions)) { allExtensions += ";" + customExtensions; } AllowedExtensions = allExtensions; } else { if (ValidationHelper.GetString(FieldInfo.Settings["extensions"], "") == "custom") { // Load allowed extensions AllowedExtensions = ValidationHelper.GetString(FieldInfo.Settings["allowed_extensions"], ""); } else { // Use site settings string siteName = SiteContext.CurrentSiteName; AllowedExtensions = SettingsKeyInfoProvider.GetValue(siteName + ".CMSUploadExtensions"); } } }
private void SetupShoppingCartPreview() { lnkShoppingCart.NavigateUrl = URLHelper.ResolveUrl(ECommerceSettings.ShoppingCartURL(SiteContext.CurrentSiteID)); lnkMyAccount.NavigateUrl = URLHelper.ResolveUrl(SettingsKeyInfoProvider.GetValue("CMSMyAccountURL", SiteContext.CurrentSiteID)); lnkMyWishList.NavigateUrl = URLHelper.ResolveUrl(ECommerceSettings.WishListURL(SiteContext.CurrentSiteID)); var cart = Service.Resolve <IShoppingService>().GetCurrentShoppingCart(); lblPrice.Text = CurrencyInfoProvider.GetFormattedPrice(cart.GrandTotal, cart.Currency); }
protected void Page_Load(object sender, EventArgs e) { PageTitle title = PageTitle; title.TitleText = GetString("mem.reg.approvaltext"); // Set administrator e-mail registrationApproval.AdministratorEmail = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSAdminEmailAddress"); registrationApproval.FromAddress = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSNoreplyEmailAddress"); }
/// <summary> /// Reloads the data in the selector. /// </summary> public void ReloadData() { uniSelector.IsLiveSite = IsLiveSite; uniSelector.ButtonClear.Visible = false; uniSelector.AllowEmpty = DisplayClearButton; uniSelector.SetValue("FilterMode", TransformationInfo.OBJECT_TYPE); uniSelector.EditDialogWindowWidth = 1200; // Set default value from settings as textbox watermark if (!String.IsNullOrEmpty(WatermarkValueSettingKey)) { string watermark = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + "." + WatermarkValueSettingKey); if (!String.IsNullOrEmpty(watermark)) { uniSelector.TextBoxSelect.WatermarkText = watermark; } } // Check if user can edit the transformation var currentUser = MembershipContext.AuthenticatedUser; bool deskAuthorized = currentUser.IsAuthorizedPerUIElement("CMS.Content", "Content"); if (deskAuthorized) { // Alias path for preview transformation string aliasPath = QueryHelper.GetString("aliaspath", String.Empty); string aliasPathParam = (aliasPath == String.Empty) ? "" : "&aliaspath=" + aliasPath; // Instance GUID string instanceGUID = QueryHelper.GetString("instanceGUID", String.Empty); string instanceGUIDParam = (instanceGUID == String.Empty) ? "" : "&instanceguid=" + instanceGUID; string isSiteManagerStr = IsSiteManager ? "&siteManager=true" : String.Empty; string query = String.Format("objectid=##ITEMID##{0}&editonlycode=1&dialog=1", isSiteManagerStr) + aliasPathParam + instanceGUIDParam; string editUrl = UIContextHelper.GetElementUrl("CMS.DocumentEngine", "EditTransformation"); uniSelector.EditItemPageUrl = URLHelper.AppendQuery(editUrl, query); string newUrl = NewDialogPath + "?editonlycode=1&dialog=1" + isSiteManagerStr + "&selectedvalue=##ITEMID##" + aliasPathParam + instanceGUIDParam; uniSelector.NewItemPageUrl = URLHelper.AddParameterToUrl(newUrl, "hash", QueryHelper.GetHash("?editonlycode=1")); uniSelector.EditDialogWindowHeight = 760; } string where = null; if (!string.IsNullOrEmpty(WhereCondition)) { where = SqlHelper.AddWhereCondition(where, WhereCondition); } if (where != null) { uniSelector.WhereCondition = where; } }
/// <summary> /// Get vendor credentials from backend payment configuration /// </summary> /// <returns></returns> public static Dictionary <string, string> GetVendorCredentials() { Dictionary <string, string> credentails = new Dictionary <string, string>(); credentails.Add("vendor", SettingsKeyInfoProvider.GetValue("vendor_id", SiteContext.CurrentSiteID)); credentails.Add("authCode", SettingsKeyInfoProvider.GetValue("auth_code", SiteContext.CurrentSiteID)); credentails.Add("product", SettingsKeyInfoProvider.GetValue("product_id", SiteContext.CurrentSiteID)); credentails.Add("tariff", SettingsKeyInfoProvider.GetValue("tariff_id", SiteContext.CurrentSiteID)); credentails.Add("password", SettingsKeyInfoProvider.GetValue("payment_access_key", SiteContext.CurrentSiteID)); return(credentails); }
/// <inheritdoc/> public string GetSettingValue(string siteName, string settingKey) { if (siteName == null) { return(SettingsKeyInfoProvider.GetValue(settingKey)); } else { return(SettingsKeyInfoProvider.GetValue(siteName + "." + settingKey)); } }
/// <summary> /// Gets the Class Names that shouldn't use the Url Slugs for their relative/absolute url. These classes will also be ignored in finding a page through the DynamicRouteHelper.GetPage() /// </summary> /// <returns>List of the class names, lower cased</returns> public static List <string> UrlSlugExcludedClassNames() { return(CacheHelper.Cache(cs => { if (cs.Cached) { cs.CacheDependency = CacheHelper.GetCacheDependency("cms.settingskey|byname|urlslugexcludedclasses"); } return ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue("UrlSlugExcludedClasses", new SiteInfoIdentifier(SiteContextSafe().SiteID)), "").ToLower().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList(); }, new CacheSettings(1440, "UrlSlugExcludedClassNames"))); }
/// <summary> /// Sets base and unsubscription URLs. /// </summary> private void SetUrls() { // Get base and unsubscription url from settings baseUrl = ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSForumBaseUrl"), ""); unsubscriptionUrl = ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSForumUnsubscriptionUrl"), ""); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "CheckBoxes", ScriptHelper.GetScript(@" function check(txtId,chk,inhV) { txt = document.getElementById(txtId); if ((txt != null)&&(chk != null)) { if (chk.checked) { txt.disabled = 'disabled'; txt.value = inhV; } else { txt.disabled = ''; } } } ")); // Force output filter to not resolve URLs in textboxes OutputFilterContext.CanResolveAllUrls = false; if (chkInheritBaseUrl.Checked) { txtForumBaseUrl.Text = baseUrl; txtForumBaseUrl.Enabled = false; } else { txtForumBaseUrl.Enabled = true; } if (chkInheritUnsubUrl.Checked) { txtUnsubscriptionUrl.Text = unsubscriptionUrl; txtUnsubscriptionUrl.Enabled = false; } else { txtUnsubscriptionUrl.Enabled = true; } chkInheritBaseUrl.Attributes.Add("onclick", "check('" + txtForumBaseUrl.ClientID + "', this,'" + baseUrl + "')"); chkInheritUnsubUrl.Attributes.Add("onclick", "check('" + txtUnsubscriptionUrl.ClientID + "', this,'" + unsubscriptionUrl + "')"); }
public static string TryGetKey() { var settingsKey = SettingsKeyInfoProvider.GetValue("CMSRecaptchaPublicKey", SiteContext.CurrentSiteID); if (string.IsNullOrWhiteSpace(settingsKey)) { settingsKey = CoreServices.AppSettings["RecaptchaV3Key"]; } return(string.IsNullOrWhiteSpace(settingsKey) ? null : settingsKey); }
/// <summary> /// Returns true if given path is excluded from URL rewriting. /// </summary> /// <param name="requestPath">Path to be checked</param> public static bool IsExcluded(string requestPath) { string customExcludedPaths = ""; // Get Custom excluded URLs path if (SiteContext.CurrentSite != null && SiteContext.CurrentSiteName != null && SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSExcludedURLs") != null) { customExcludedPaths = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSExcludedURLs"); } return(URLHelper.IsExcluded(requestPath, customExcludedPaths)); }
protected async Task <List <ContentType> > getCloudContentTypes() { string KenticoCloudProjectID = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".KenticoCloudProjectId"); DeliveryClient client = new DeliveryClient(KenticoCloudProjectID); DeliveryTypeListingResponse response = await client.GetTypesAsync(); var types = response.Types; return(types.ToList()); }
/// <summary> /// Fills check box list with current values /// </summary> private void FillItems() { Dictionary <String, bool> items = OutputCache ? CacheHelper.GetCombinedCacheItems(SettingsKeyInfoProvider.GetValue("CMSOutputCacheItems"), OutputHelper.AvailableCacheItemNames) : CacheHelper.GetCombinedCacheItems(SettingsKeyInfoProvider.GetValue("CMSPartialCacheItems"), CMSAbstractWebPart.AvailableCacheItemNames); foreach (var item in items) { ListItem li = new ListItem(item.Key, item.Key); chkList.Items.Add(li); li.Selected = item.Value; } }
private string GetCredentials() { string settingName = "CMSSalesForceCredentials"; SiteInfo site = GetCurrentSiteForSettings(); if (site != null) { settingName = String.Format("{0}.{1}", site.SiteName, settingName); } return(SettingsKeyInfoProvider.GetValue(settingName)); }