Akismet.NET.Validator.PreparePars C# (CSharp) Method

PreparePars() protected method

Prepare request parameters based on the input comment.
protected PreparePars ( Comment comment ) : NameValueCollection
comment Comment The input comment.
return System.Collections.Specialized.NameValueCollection
        protected virtual NameValueCollection PreparePars(Comment comment)
        {
            // check the input parameters
            if ((null != comment) && (!comment.IsValid))
                return null;

            // initialize result
            NameValueCollection result = new NameValueCollection();

            // add required information
            result["blog"] = HttpUtility.UrlEncode(comment.blog);
            result["user_ip"] = HttpUtility.UrlEncode(comment.user_ip);
            result["user_agent"] = HttpUtility.UrlEncode(comment.user_agent);
            // add optional information
            result["referrer"] = String.IsNullOrEmpty(comment.referrer) ? String.Empty : HttpUtility.UrlEncode(comment.referrer);
            result["permalink"] = String.IsNullOrEmpty(comment.permalink) ? String.Empty : HttpUtility.UrlEncode(comment.permalink);
            result["comment_type"] = String.IsNullOrEmpty(comment.comment_type) ? String.Empty : HttpUtility.UrlEncode(comment.comment_type);
            result["comment_author"] = String.IsNullOrEmpty(comment.comment_author) ? String.Empty : HttpUtility.UrlEncode(comment.comment_author);
            result["comment_author_email"] = String.IsNullOrEmpty(comment.comment_author_email) ? String.Empty : HttpUtility.UrlEncode(comment.comment_author_email);
            result["comment_author_url"] = String.IsNullOrEmpty(comment.comment_author_url) ? String.Empty : HttpUtility.UrlEncode(comment.comment_author_url);
            result["comment_content"] = String.IsNullOrEmpty(comment.comment_content) ? String.Empty : HttpUtility.UrlEncode(comment.comment_content);

            // return result
            return result;
        }

Same methods

Validator::PreparePars ( String key, String domain ) : NameValueCollection