Exemplo n.º 1
0
 protected virtual bool HasRelCanonicalPointingToDifferentUrl(IDomElement e, string orginalUrl)
 {
     return(e.HasAttribute("rel") && !string.IsNullOrWhiteSpace(e.Attributes["rel"]) &&
            string.Equals(e.Attributes["rel"], "canonical", StringComparison.OrdinalIgnoreCase) &&
            e.HasAttribute("href") && !string.IsNullOrWhiteSpace(e.Attributes["href"]) &&
            !string.Equals(e.Attributes["href"], orginalUrl, StringComparison.OrdinalIgnoreCase));
 }
Exemplo n.º 2
0
 protected virtual bool HasRelCanonicalPointingToDifferentUrl(IDomElement e, string orginalUrl)
 {
     return e.HasAttribute("rel") && !string.IsNullOrWhiteSpace(e.Attributes["rel"]) &&
             string.Equals(e.Attributes["rel"], "canonical", StringComparison.OrdinalIgnoreCase) &&
             e.HasAttribute("href") && !string.IsNullOrWhiteSpace(e.Attributes["href"]) &&
             !string.Equals(e.Attributes["href"], orginalUrl, StringComparison.OrdinalIgnoreCase);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Has "rel" canonical pointing To different url
 /// </summary>
 /// <param name="element"></param>
 /// <param name="orginalUrl"></param>
 /// <returns></returns>
 protected virtual bool HasRelCanonicalPointingToDifferentUrl(IDomElement element, string orginalUrl)
 {
     return(element.HasAttribute(Rel) &&
            !string.IsNullOrWhiteSpace(element.Attributes[Rel]) &&
            string.Equals(element.Attributes[Rel], Canonical, StringComparison.OrdinalIgnoreCase) &&
            element.HasAttribute(Href) &&
            !string.IsNullOrWhiteSpace(element.Attributes[Href]) &&
            !string.Equals(element.Attributes[Href], orginalUrl, StringComparison.OrdinalIgnoreCase));
 }
Exemplo n.º 4
0
        private bool IsValidOGNode(IDomElement elem)
        {
            if (!elem.HasAttribute("property"))
            {
                return(false);
            }

            return(elem.GetAttribute("property").StartsWith("og:"));
        }
Exemplo n.º 5
0
        public override MatchResult Match <TDependencyObject, TDependencyProperty>(StyleSheet styleSheet, ref IDomElement <TDependencyObject, TDependencyProperty> domElement, SelectorMatcher[] fragments, ref int currentIndex)
        {
            if (!domElement.HasAttribute(PropertyName))
            {
                return(MatchResult.ItemFailed);
            }

            var dependencyProperty = domElement.Attributes[PropertyName];

            domElement.EnsureAttributeWatcher(dependencyProperty);

            // just check if it exists - here: is not null
            if (Value == null)
            {
                return(domElement.GetAttributeValue(dependencyProperty) != null ? MatchResult.Success : MatchResult.ItemFailed);
            }

            if (Operator == "=")
            {
                return(domElement.GetAttributeValue(dependencyProperty)?.ToString() == Value ? MatchResult.Success : MatchResult.ItemFailed);
            }

            //else if (Operator == "~=")
            //{
            //    var v = domElement.GetAttributeValue(dependencyProperty);
            //    if (v is IEnumerable e)
            //    {
            //        foreach (var item in e)
            //        {
            //            if (item?.ToString() == Value)
            //            {
            //                return MatchResult.Success;
            //            }
            //        }
            //    }

            //    return MatchResult.ItemFailed;
            //}
            //else if (Operator == "|=")
            //{
            //    var v = domElement.GetAttributeValue(dependencyProperty);
            //    if (v is IEnumerable e)
            //    {
            //        foreach (var item in e)
            //        {
            //            if (item?.ToString() == Value)
            //            {
            //                return MatchResult.Success;
            //            }
            //        }
            //    }

            //    return MatchResult.ItemFailed;
            //}

            return(MatchResult.ItemFailed);
        }
Exemplo n.º 6
0
 protected virtual bool HasRelNoFollow(IDomElement e)
 {
     return _config.IsRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow");
 }
Exemplo n.º 7
0
 private bool HasRelNoFollow(IDomElement e)
 {
     return _isRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow");
 }
Exemplo n.º 8
0
 private bool HasRelNoFollow(IDomElement e)
 {
     return(_isRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow"));
 }
Exemplo n.º 9
0
 protected virtual bool HasRelNoFollow(IDomElement e)
 {
     return(_config.IsRespectAnchorRelNoFollowEnabled && (e.HasAttribute("rel") && e.GetAttribute("rel").ToLower().Trim() == "nofollow"));
 }
Exemplo n.º 10
0
 /// <summary>
 /// True, if element has "rel" attribute == "nofollow"
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 protected virtual bool HasRelNoFollow(IDomElement element)
 {
     return(Config.IsRespectAnchorRelNoFollowEnabled &&
            element.HasAttribute(Rel) &&
            element.GetAttribute(Rel).ToLower().Trim() == NoFollow);
 }