Beispiel #1
0
        public static void Eval(Php54Scope Scope, Php54Var Variable)
        {
            IPhp54Function EvalFunction;
            try
            {
                 EvalFunction = Scope.Runtime.CreateMethodFromPhpCode(Variable.StringValue, "eval()");
            }
            catch (Exception Exception)
            {
                Console.WriteLine(Exception);
                return;
            }

            EvalFunction.Execute(Scope);
        }
Beispiel #2
0
        public void Execute(Php54Scope Scope)
        {
            if (StaticScope == null)
            {
                this.StaticScope = new Php54Scope(Scope.Runtime);
            }

            var OldStaticScope = Scope.StaticScope;
            try
            {
                Scope.StaticScope = this.StaticScope;
                Code(Scope);
            }
            finally
            {
                Scope.StaticScope = OldStaticScope;
            }
        }
Beispiel #3
0
 public static Php54Var GetGlobal(Php54Scope Scope, string Name)
 {
     return Scope.Runtime.GlobalScope.GetVariable(Name);
 }
Beispiel #4
0
 public static void Echo(Php54Scope Scope, Php54Var Variable)
 {
     //Scope.Php54Runtime.TextWriter.Write(Variable);
     Console.Out.Write(Variable);
 }
Beispiel #5
0
 public void Reset()
 {
     this.ConstantScope = new Php54Scope(this);
     this.GlobalScope = new Php54Scope(this);
     this.ShutdownFunction = null;
     OutputFunctions.__ob_reset();
 }
Beispiel #6
0
        public static void Include(Php54Scope Scope, string Path, bool IsRequire, bool IsOnce)
        {
            var Runtime = Scope.Runtime;
            var FullPath = new FileInfo(Path).FullName;
            if (IsOnce)
            {
                if (Runtime.IncludedPaths.Contains(FullPath)) return;
            }

            var Method = Scope.Runtime.CreateMethodFromPhpFile(File.ReadAllText(FullPath), FullPath);
            Method.Execute(Scope);

            //Scope.Php54Runtime.TextWriter.Write(Variable);
            //Console.Out.Write(Variable);
            //throw(new NotImplementedException("Can't find path '" + Path + "' Require:" + IsRequire + ", Once:" + IsOnce + ""));
        }
Beispiel #7
0
 public static Php54Var GetStatic(Php54Scope Scope, string Name)
 {
     return Scope.StaticScope.GetVariable(Name);
 }
Beispiel #8
0
 public void Execute(Php54Scope Scope)
 {
     if (CachedFunction == null)
     {
         CachedFunction = CodeGenerator();
     }
     CachedFunction.Execute(Scope);
 }