protected virtual string EscapeUserKey(ContentBase content, string userKey) { string tmpUserKey = userKey.StripAllTags(); //http://stackoverflow.com/questions/9565360/how-to-convert-utf-8-characters-to-ascii-for-use-in-a-url/9628594#9628594 tmpUserKey = RemoveDiacritics(tmpUserKey); Repository repository = content.GetRepository().AsActual(); tmpUserKey = Regex.Replace(tmpUserKey, repository.UserKeyReplacePattern, repository.UserKeyHyphens); return tmpUserKey; }
protected virtual string EscapeUserKey(ContentBase content, string userKey) { string tmpUserKey = userKey.StripAllTags(); //http://stackoverflow.com/questions/9565360/how-to-convert-utf-8-characters-to-ascii-for-use-in-a-url/9628594#9628594 tmpUserKey = RemoveDiacritics(tmpUserKey); Repository repository = content.GetRepository().AsActual(); tmpUserKey = Regex.Replace(tmpUserKey, repository.UserKeyReplacePattern, repository.UserKeyHyphens); return(tmpUserKey); }
public virtual string Generate(ContentBase content) { string userKey = content.UserKey; //#warning sqlce test... // return userKey; if (string.IsNullOrEmpty(userKey)) { userKey = GetColumnValueForUserKey(content); if (!string.IsNullOrEmpty(userKey)) { Repository repository = content.GetRepository().AsActual(); userKey = TrimUserKey(userKey, repository.UserKeyReplacePattern, repository.UserKeyHyphens); } } if (string.IsNullOrEmpty(userKey)) { userKey = content.UUID; } else { if (userKey.Length > 90) { userKey = userKey.Substring(0, 90); } int tries = 0; string tmpUserKey = userKey.StripAllTags(); while (IfUserKeyExists(content, tmpUserKey)) { tries++; tmpUserKey = userKey + "-" + tries.ToString(); } userKey = tmpUserKey; } return(userKey); }
public virtual string Generate(ContentBase content) { string userKey = content.UserKey; //#warning sqlce test... // return userKey; if (string.IsNullOrEmpty(userKey)) { userKey = GetColumnValueForUserKey(content); if (!string.IsNullOrEmpty(userKey)) { Repository repository = content.GetRepository().AsActual(); userKey = TrimUserKey(userKey, repository.UserKeyReplacePattern, repository.UserKeyHyphens); } } if (string.IsNullOrEmpty(userKey)) { userKey = content.UUID; } else { if (userKey.Length > 90) { userKey = userKey.Substring(0, 90); } int tries = 0; string tmpUserKey = userKey.StripAllTags(); while (IfUserKeyExists(content, tmpUserKey)) { tries++; tmpUserKey = userKey + "-" + tries.ToString(); } userKey = tmpUserKey; } return userKey; }