Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 private static UrlRewriter /*!*/ GetOrCreate()
 {
     if (current == null)
     {
         current = new UrlRewriter();
     }
     return(current);
 }
Ejemplo n.º 4
0
 public TagsUrlRewriter(UrlRewriter rewriter)
 {
     this.rewriter = rewriter;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Clears thread static field. Called on request end.
 /// </summary>
 public static void Clear()
 {
     current = null;
 }
Ejemplo n.º 6
0
 public TagsUrlRewriter(UrlRewriter rewriter)
 {
     this.rewriter = rewriter;
 }
Ejemplo n.º 7
0
		private static UrlRewriter/*!*/ GetOrCreate()
		{
			if (current == null) current = new UrlRewriter();
			return current;
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Clears thread static field. Called on request end.
		/// </summary>
		public static void Clear()
		{
			current = null;
		}