/// <summary>
        /// Gets the ip address from current request.
        /// </summary>
        /// <returns></returns>
        public static string GetIpAddressFromCurrentRequest()
        {
            var authorIpAddressObject = CommentsUtilitiesReflector.Reflect("GetIpAddressFromCurrentRequest");
            var authorIpAddress       = authorIpAddressObject as string;

            return(authorIpAddress);
        }
        /// <summary>
        /// Gets the author.
        /// </summary>
        /// <param name="commentData">The comment data.</param>
        /// <returns></returns>
        public static IAuthor GetAuthor(CommentCreateRequest commentData)
        {
            var authorObject = CommentsUtilitiesReflector.Reflect("GetAuthor", commentData);
            var author       = authorObject as IAuthor;

            return(author);
        }
        /// <summary>
        /// Gets the comment response.
        /// </summary>
        /// <param name="comment">The comment.</param>
        /// <param name="includeSensitiveInformation">if set to <c>true</c> [include sensitive information].</param>
        /// <returns></returns>
        public static CommentResponse GetCommentResponse(IComment comment, bool includeSensitiveInformation = false)
        {
            var commentResponseObject = CommentsUtilitiesReflector.Reflect("GetCommentResponse", comment, includeSensitiveInformation);

            var commentResponse = commentResponseObject as CommentResponse;

            return(commentResponse);
        }
        /// <summary>
        /// Gets the comments by thread for current author with rating.
        /// </summary>
        /// <param name="threadKey">The thread key.</param>
        /// <returns></returns>
        public static IEnumerable <IComment> GetCommentsByThreadForCurrentAuthorWithRating(string threadKey)
        {
            object commentsObject = CommentsUtilitiesReflector.Reflect("GetCommentsByThreadForCurrentAuthorWithRating", threadKey, SystemManager.GetCommentsService());

            var comments = commentsObject as IEnumerable <IComment>;

            return(comments);
        }
        /// <summary>
        /// Gets the type of the thread configuration by.
        /// </summary>
        /// <param name="threadType">Type of the thread.</param>
        /// <returns></returns>
        public static CommentsSettingsElement GetThreadConfigByType(string threadType, string threadKey)
        {
            Type commentsSettingsElementType = Type.GetType("Telerik.Sitefinity.Modules.Comments.Configuration.CommentsSettingsElement, Telerik.Sitefinity");

            object commentsSettingsElementObject = CommentsUtilitiesReflector.Reflect("GetThreadConfigByType", threadType);

            var result = new CommentsSettingsElement()
            {
                AllowComments          = (bool)commentsSettingsElementType.GetProperty("AllowComments").GetValue(commentsSettingsElementObject, null),
                RequiresAuthentication = (bool)commentsSettingsElementType.GetProperty("RequiresAuthentication").GetValue(commentsSettingsElementObject, null),
                RequiresApproval       = (bool)commentsSettingsElementType.GetProperty("RequiresApproval").GetValue(commentsSettingsElementObject, null)
            };

            result.EnableRatings = threadKey.EndsWith("_review", StringComparison.Ordinal);

            return(result);
        }
 /// <summary>
 /// Removes specified key from temp storage.
 /// </summary>
 /// <param name="key">The key.</param>
 public static void RemoveCaptchaFromTempStorage(string key)
 {
     CommentsUtilitiesReflector.Reflect("RemoveCaptchaFromTempStorage", key);
 }