Exemple #1
0
        private void SaveSettings(HtmlOptimiserSettings settings)
        {
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);

            _settingService.SaveSetting(settings, x => x.RemoveHeaders, storeScope, false);
            _settingService.SaveSetting(settings, x => x.AddHeaders, storeScope, false);

            _settingService.ClearCache();

            WebConfigUpdater.UpdateWebConfig(settings.RemoveHeaders);

            RestartPlugin();
        }
Exemple #2
0
        public WhitespaceFilter(Stream stream, HtmlOptimiserSettings settings)
        {
            _stream = stream;

            // intialize the HTML minifier with the chosen settings
            htmlMinifier = new HtmlMinifier(
                settings: new HtmlMinificationSettings()
            {
                MinifyEmbeddedJsCode  = settings.MinifyInlineScripts,
                MinifyInlineJsCode    = settings.MinifyInlineScripts,
                MinifyEmbeddedCssCode = settings.MinifyInlineStyles,
                MinifyInlineCssCode   = settings.MinifyInlineStyles,
                RemoveCdataSectionsFromScriptsAndStyles = settings.RemoveCDATASections,
                RemoveHtmlComments = settings.RemoveHtmlComments,
                RemoveHtmlCommentsFromScriptsAndStyles = settings.RemoveScriptComments,
                RemoveRedundantAttributes  = settings.RemoveRedundantAttributes,
                RemoveOptionalEndTags      = settings.RemoveOptionalEndTags,
                AttributeQuotesRemovalMode = (settings.RemoveQuotes ? HtmlAttributeQuotesRemovalMode.Html5 : HtmlAttributeQuotesRemovalMode.KeepQuotes),
                UseShortDoctype            = settings.UseShortDocType,
                WhitespaceMinificationMode = (settings.RemoveWhitespace ? WhitespaceMinificationMode.Medium : WhitespaceMinificationMode.None)
            }
                );
        }
        public HtmlFilterAttribute()
        {
            _settingService = EngineContext.Current.Resolve <ISettingService>();

            settings = _settingService.LoadSetting <HtmlOptimiserSettings>();
        }