internal static IEnumerable <string> GetLegacyActionJsForActions(LegacyJsActionType type, IEnumerable <string> values)
        {
            var blockList = new List <string>();
            var urlList   = new List <string>();

            foreach (var jsFile in values)
            {
                var isJsPath = jsFile.DetectIsJavaScriptPath();
                if (isJsPath.Success)

                {
                    urlList.Add(isJsPath.Result);
                }
                else
                {
                    blockList.Add(isJsPath.Result);
                }
            }

            switch (type)
            {
            case LegacyJsActionType.JsBlock:
                return(blockList);

            case LegacyJsActionType.JsUrl:
                return(urlList);
            }

            return(blockList);
        }
 /// <summary>
 /// Renders out all JavaScript references that have bee declared in IActions
 /// </summary>
 private static IEnumerable <string> GetLegacyActionJs(LegacyJsActionType type)
 {
     return(GetLegacyActionJsForActions(type, Action.GetJavaScriptFileReferences()));
 }
        /// <summary>
        /// Renders out all JavaScript references that have bee declared in IActions
        /// </summary>
        private static IEnumerable<string> GetLegacyActionJs(LegacyJsActionType type)
        {
            var blockList = new List<string>();
            var urlList = new List<string>();
            foreach (var jsFile in global::umbraco.BusinessLogic.Actions.Action.GetJavaScriptFileReferences())
            {
                //validate that this is a url, if it is not, we'll assume that it is a text block and render it as a text
                //block instead.
                var isValid = true;
                
                if (Uri.IsWellFormedUriString(jsFile, UriKind.RelativeOrAbsolute))
                {
                    //ok it validates, but so does alert('hello'); ! so we need to do more checks

                    //here are the valid chars in a url without escaping
                    if (Regex.IsMatch(jsFile, @"[^a-zA-Z0-9-._~:/?#\[\]@!$&'\(\)*\+,%;=]"))
                        isValid = false;

                    //we'll have to be smarter and just check for certain js patterns now too!
                    var jsPatterns = new string[] {@"\+\s*\=", @"\);", @"function\s*\(", @"!=", @"=="};
                    if (jsPatterns.Any(p => Regex.IsMatch(jsFile, p)))
                    {
                        isValid = false;
                    }
                    if (isValid)
                    {
                        //it is a valid URL add to Url list
                        urlList.Add(jsFile);
                    }
                }
                else
                {
                    isValid = false;
                }

                if (isValid == false)
                {
                    //it isn't a valid URL, must be a js block
                    blockList.Add(jsFile);                     
                }
            }

            switch (type)
            {
                case LegacyJsActionType.JsBlock:
                    return blockList;
                case LegacyJsActionType.JsUrl:
                    return urlList;
            }

            return blockList;
        }