public static bool ResetRewriteVariables() { /*PhpException.FunctionNotSupported(); * return false;*/ ScriptContext context = ScriptContext.CurrentContext; UrlRewriter rewriter = UrlRewriter.Current; BufferedOutput output = context.BufferedOutput; if (rewriter == null || output.Level == 0 || output.GetFilter() != rewriter.filterCallback) { return(false); } // some output flush output.Flush(); rewriter.Variables.Clear(); output.DecreaseLevel(false); if (output.Level == 0) { context.IsOutputBuffered = false; } return(true); }
public static bool AddRewriteVariable(string name, string value) { if (String.IsNullOrEmpty(name)) { PhpException.InvalidArgument("name", LibResources.GetString("arg:null_or_empty")); return(false); } ScriptContext context = ScriptContext.CurrentContext; UrlRewriter rewriter = UrlRewriter.GetOrCreate(); BufferedOutput output = context.BufferedOutput; // some output flush output.Flush(); rewriter.Variables[name] = value; // start UrlRewriter filtering if not yet if (output.FindLevelByFilter(rewriter.filterCallback) < 0) { // create new output buffer level (URL-Rewriter is not started yet) int Level = output.IncreaseLevel(); output.SetFilter(rewriter.GetOrCreateFilterCallback(context), Level); output.SetLevelName(Level, "URL-Rewriter"); } context.IsOutputBuffered = true; // turn on output buffering if not yet return(true); }
private static UrlRewriter /*!*/ GetOrCreate() { if (current == null) { current = new UrlRewriter(); } return(current); }
public TagsUrlRewriter(UrlRewriter rewriter) { this.rewriter = rewriter; }
/// <summary> /// Clears thread static field. Called on request end. /// </summary> public static void Clear() { current = null; }
private static UrlRewriter/*!*/ GetOrCreate() { if (current == null) current = new UrlRewriter(); return current; }