20240311-1
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| using anbs_cp.ForNet.Enums; | ||||
|  | ||||
| using Ganss.Xss; | ||||
|  | ||||
| namespace anbs_cp.ForNet.Classes; | ||||
| @@ -40,12 +41,12 @@ public static class Sanitizer | ||||
|   #region Методы | ||||
|  | ||||
|   /// <summary> | ||||
|     /// Очистка html-кода <paramref name="html"/> согласно параметрам <paramref name="allowedHtml"/> | ||||
|   ///   Очистка html-кода <paramref name="html" /> согласно параметрам <paramref name="allowedHtml" /> | ||||
|   /// </summary> | ||||
|   /// <param name="html">HTML-код</param> | ||||
|   /// <param name="allowedHtml">Параметры очистки</param> | ||||
|   /// <returns>Очищенный html-кода</returns> | ||||
|     private static string SanitizeHtml(string html, SanitizerAllowedHtml allowedHtml) | ||||
|   public static string SanitizeHtml (string html, SanitizerAllowedHtml allowedHtml) | ||||
|   { | ||||
|     // Создаю очиститель | ||||
|     HtmlSanitizer sanitizer = new() | ||||
| @@ -81,7 +82,7 @@ public static class Sanitizer | ||||
|   /// <param name="html">HTML-код</param> | ||||
|   /// <param name="level">Уровень очистка</param> | ||||
|   /// <returns>Очищенный html-код</returns> | ||||
|     public static string SanitizeHtml(string html, ESanitizerLevel level) | ||||
|   public static string SanitizeHtml (string html, ESanitizerLevel level) | ||||
|   { | ||||
|     // Получаю параметры очистки | ||||
|     SanitizerAllowedHtml allowedHtml = level switch | ||||
| @@ -106,7 +107,7 @@ public static class Sanitizer | ||||
|   ///   Получаю параметры, удаляющие все теги | ||||
|   /// </summary> | ||||
|   /// <returns>Параметры очистки</returns> | ||||
|     private static SanitizerAllowedHtml GetNone() => | ||||
|   private static SanitizerAllowedHtml GetNone () => | ||||
|     new() | ||||
|     { | ||||
|       AllowedTags = [], | ||||
| @@ -121,7 +122,7 @@ public static class Sanitizer | ||||
|   ///   Получаю параметры по умолчанию (разрешающие все теги) | ||||
|   /// </summary> | ||||
|   /// <returns>Параметры очистки</returns> | ||||
|     private static SanitizerAllowedHtml GetAll() | ||||
|   private static SanitizerAllowedHtml GetAll () | ||||
|   { | ||||
|     // Создаю очиститель | ||||
|     HtmlSanitizer sanitizer = new(); | ||||
| @@ -142,7 +143,7 @@ public static class Sanitizer | ||||
|   ///   Параметры, оставляющие только текстовые теги | ||||
|   /// </summary> | ||||
|   /// <returns>Параметры очистки</returns> | ||||
|     private static SanitizerAllowedHtml GetTextFormatOnly() => | ||||
|   private static SanitizerAllowedHtml GetTextFormatOnly () => | ||||
|     new() | ||||
|     { | ||||
|       AllowedTags = | ||||
| @@ -170,7 +171,7 @@ public static class Sanitizer | ||||
|   ///   Параметры, оставляющие только текстовые теги, а также img и a | ||||
|   /// </summary> | ||||
|   /// <returns>Параметры очистки</returns> | ||||
|     private static SanitizerAllowedHtml GetImageAndLinks() | ||||
|   private static SanitizerAllowedHtml GetImageAndLinks () | ||||
|   { | ||||
|     // Получаю текстовые параметры | ||||
|     SanitizerAllowedHtml result = AllowedTextOnly; | ||||
| @@ -191,7 +192,7 @@ public static class Sanitizer | ||||
|   ///   Применяются все теги, кроме iframe | ||||
|   /// </summary> | ||||
|   /// <returns>Параметры очистки</returns> | ||||
|     private static SanitizerAllowedHtml GetAllExceptIFrame() | ||||
|   private static SanitizerAllowedHtml GetAllExceptIFrame () | ||||
|   { | ||||
|     // Получаю все параметры | ||||
|     SanitizerAllowedHtml result = AllowedAll; | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|     <Nullable>enable</Nullable> | ||||
|     <GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||||
|     <PackageId>ANBSoftware.ComponentsPackForNet</PackageId> | ||||
|     <Version>2024.3.11.0</Version> | ||||
|     <Version>2024.3.11.1</Version> | ||||
|     <Authors>Александр Бабаев</Authors> | ||||
|     <Product>Набор компонентов ANB Software для ASP.NET Core</Product> | ||||
|     <Description>Библиотека полезных методов языка C# для ASP.NET Core</Description> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user