ReplaceIDTokens() private method

private ReplaceIDTokens ( string script, Control seed ) : string
script string
seed System.Web.UI.Control
return string
        public static string ParseTokens(string script, Control seed)
        {
            if (script == null)
            {
                return(null);
            }

            if (script.ToString().StartsWith("<!token>"))
            {
                return(script.ToString().Substring(8));
            }

            if (seed == null)
            {
                seed = TokenUtils.Page;
            }

            bool isRaw = (
                TokenUtils.IsAlertToken(script) ||
                TokenUtils.IsRawToken(script) ||
                TokenUtils.IsSelectToken(script));

            script = TokenUtils.ReplaceIDTokens(script, seed);
            script = TokenUtils.ReplaceSelectTokens(script);

            script = TokenUtils.ReplaceAlertToken(script);
            script = TokenUtils.ReplaceRawToken(script);
            script = TokenUtils.ReplaceFunctionToken(script);

            return((isRaw || TokenUtils.IsFunction(script)) ? "<raw>".ConcatWith(script) : script);
        }
示例#2
0
        public static string ParseTokens(string script, bool addRawMarker, Control seed)
        {
            TokenSettings settings = TokenUtils.Settings;

            if (script == null)
            {
                return(null);
            }

            if (script.ToString().StartsWith("<!token>"))
            {
                return(script.ToString().Substring(8));
            }

            if (settings.Disable || (settings.DisableDuringDirectEvent && X.IsAjaxRequest))
            {
                return(script);
            }

            if (seed == null)
            {
                seed = TokenUtils.Page;
            }

            bool isRaw = (
                TokenUtils.IsAlertToken(script) ||
                TokenUtils.IsRawToken(script) ||
                TokenUtils.IsSelectToken(script));

            script = TokenUtils.ReplaceIDTokens(script, seed);
            script = TokenUtils.ReplaceSelectTokens(script);

            script = TokenUtils.ReplaceAlertToken(script);
            script = TokenUtils.ReplaceRawToken(script);
            script = TokenUtils.ReplaceFunctionToken(script);

            return((addRawMarker && (isRaw || TokenUtils.IsFunction(script))) ? TokenUtils.Settings.RawMarker.ConcatWith(script) : script);
        }