ReplaceSelectTokens() private method

private ReplaceSelectTokens ( string script ) : string
script string
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);
        }
Beispiel #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);
        }