public void Check() { this.session.Headline = Data.Language.Hardcoded.GetValue("Scanning links", this.session.context); var context = this.session.context; var sitedb = this.session.context.WebSite.SiteDb(); var allroutes = sitedb.Routes.Query.Where(o => o.DestinationConstType == ConstObjectType.Page).SelectAll(); foreach (var item in allroutes) { if (item.objectId == default(Guid)) { var usedby = sitedb.Routes.GetUsedBy(item.Id); var ImageDataUri = Kooboo.Lib.Utilities.DataUriService.isDataUri(item.Name); if (!ImageDataUri) { string message = item.Name + "; " + DiagnosisHelper.DisplayUsedBy(session.context, usedby); this.session.AddMessage(Hardcoded.GetValue("Missing link", context), message, MessageType.Critical); } } } }
public void Check() { var sitedb = session.context.WebSite.SiteDb(); string name = Hardcoded.GetValue("missing image", session.context); session.Headline = Hardcoded.GetValue("Checking", session.context) + " " + name; var allroutes = sitedb.Routes.Query.Where(o => o.DestinationConstType == ConstObjectType.Image).SelectAll(); foreach (var item in allroutes) { if (item.objectId == default(Guid)) { string message = item.Name; var usedby = sitedb.Routes.GetUsedBy(item.Id); if (usedby.Any()) { message += DiagnosisHelper.DisplayUsedBy(session.context, usedby); session.AddMessage(Hardcoded.GetValue("Missing image", this.session.context), message, MessageType.Critical); } } } }
public void Check() { string checking = Hardcoded.GetValue("Checking", this.session.context); string name = Hardcoded.GetValue("duplicate id", this.session.context); session.Headline = checking + " " + name; var sitedb = session.context.WebSite.SiteDb(); foreach (var repo in sitedb.ActiveRepositories()) { if (Lib.Reflection.TypeHelper.HasInterface(repo.ModelType, typeof(IDomObject))) { var allitems = repo.All(); foreach (var item in allitems) { var domitem = item as IDomObject; var dom = domitem.Dom; var ids = new HashSet <string>(); var allidelements = dom.getElementByAttribute("id"); foreach (var el in allidelements.item) { if (IsSystemTag(el)) { continue; } var id = el.id; if (!string.IsNullOrEmpty(id)) { if (ids.Contains(id)) { string opentag = HttpUtility.HtmlEncode(Service.DomService.GetOpenTag(el)); var message = id + " " + opentag; message += DiagnosisHelper.DisplayUsedBy(session.context, item as SiteObject); session.AddMessage(name, message, MessageType.Critical); } else { ids.Add(id); } } } } } } }
public void CheckEmptyTag(SiteObject siteobject, Kooboo.Dom.Document dom) { if (siteobject == null || dom == null) { return; } string name = Hardcoded.GetValue("Empty tag", session.context); HTMLCollection col = new HTMLCollection(); getEmptyTag(dom.body, col); foreach (var item in col.item) { string message = HttpUtility.HtmlEncode(item.OuterHtml); message += DiagnosisHelper.DisplayUsedBy(session.context, siteobject); session.AddMessage(name, message, MessageType.Warning); } }
public void CheckWrongNestedTag(SiteObject siteobject, Kooboo.Dom.Document dom) { if (siteobject == null || dom == null) { return; } string name = Hardcoded.GetValue("Wrong nested tag", session.context); HTMLCollection col = new HTMLCollection(); getWrongNestedTags(dom.body, col); foreach (var item in col.item) { string message = GetTagInfo(item); message += DiagnosisHelper.DisplayUsedBy(session.context, siteobject); session.AddMessage(name, message, MessageType.Warning); } }
public void CheckDepth(SiteObject siteobject, Kooboo.Dom.Document dom) { if (siteobject == null || dom == null) { return; } string name = Hardcoded.GetValue("Element too deep", session.context); HTMLCollection col = new HTMLCollection(); getTooDepthElements(dom.documentElement, col); foreach (var item in col.item) { string message = GetTagInfo(item); message += DiagnosisHelper.DisplayUsedBy(session.context, siteobject); session.AddMessage(name, message, MessageType.Warning); } }
public void Check() { string name = Hardcoded.GetValue("image size", session.context); session.Headline = Hardcoded.GetValue("Checking", session.context) + " " + name; var sitedb = session.context.WebSite.SiteDb(); var allimages = sitedb.Images.All(true); int maxsize = 1024 * 1024; int terriblesize = 5 * maxsize; foreach (var item in allimages) { var imageNameText = Hardcoded.GetValue("Name", session.context); var imageSizeText = Hardcoded.GetValue("Size", session.context); int size = item.Size; string message = string.Format("<b>{0}: {1}, {2}: {3}<b><br/>", imageNameText, item.Name, imageSizeText, Kooboo.Lib.Utilities.CalculateUtility.GetSizeString(size)); if (size > terriblesize) { var usedby = sitedb.Images.GetUsedBy(item.Id); message += DiagnosisHelper.DisplayUsedBy(session.context, usedby); session.AddMessage(name, message, MessageType.Critical); } else if (size > maxsize) { var usedby = sitedb.Images.GetUsedBy(item.Id); message += DiagnosisHelper.DisplayUsedBy(session.context, usedby); session.AddMessage(name, message, MessageType.Warning); } } }
public void Check() { var sitedb = this.session.context.WebSite.SiteDb(); this.session.Headline = Hardcoded.GetValue("Checking", session.context) + " " + Hardcoded.GetValue("Dom structure", session.context) + "..."; var allrepos = sitedb.AllRepositories; string name = Hardcoded.GetValue("Dom structure error", session.context); foreach (var repo in allrepos) { if (Lib.Reflection.TypeHelper.HasInterface(repo.ModelType, typeof(IDomObject))) { var allitems = repo.All(); foreach (var item in allitems) { var domobj = item as DomObject; if (domobj != null) { List <string> errors = new List <string>(); var dom = Kooboo.Dom.DomParser.CreateDom(domobj.Body, errors); foreach (var err in errors) { string message = err; message += DiagnosisHelper.DisplayUsedBy(session.context, domobj as SiteObject); session.AddMessage(name, message, MessageType.Warning); } } } } } }