Пример #1
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);
        }
Пример #2
0
        public static string ReplaceSelectTokens(string script)
        {
            TokenSettings settings = TokenUtils.Settings;

            return(settings.SelectParsingDisable ? script : settings.Select_Pattern_RE.Replace(script, new MatchEvaluator(TokenUtils.MatchSelectTokens)));
        }