Esempio n. 1
0
        ///// <summary>
        ///// Gets a list of implemented extensions.
        ///// </summary>
        //public override string[] ImplementedExtensions
        //{
        //    get { return new string[] { ExtensionName }; }
        //}
        //internal const string ExtensionName = "zlib";

        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            XmlConfiguration.RegisterLegacyOptions();
        }
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PDOMySQLConfiguration.RegisterLegacyOptions();

            PDOLibraryDescriptor.RegisterProvider(new MySQLPDODriver());

            string fullname = typeof(PDO).Name;
            var    tPDO     = ApplicationContext.Default.GetType(new QualifiedName(new Name(typeof(PDO).FullName)), ref fullname);

            Core.Reflection.PhpMemberAttributes att = Core.Reflection.PhpMemberAttributes.Public | Core.Reflection.PhpMemberAttributes.Static;
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_USE_BUFFERED_QUERY", MySQLPDODriver.MYSQL_ATTR_USE_BUFFERED_QUERY);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_INIT_COMMAND", MySQLPDODriver.MYSQL_ATTR_INIT_COMMAND);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_READ_DEFAULT_FILE", MySQLPDODriver.MYSQL_ATTR_READ_DEFAULT_FILE);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_READ_DEFAULT_GROUP", MySQLPDODriver.MYSQL_ATTR_READ_DEFAULT_GROUP);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_MAX_BUFFER_SIZE", MySQLPDODriver.MYSQL_ATTR_MAX_BUFFER_SIZE);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_DIRECT_QUERY", MySQLPDODriver.MYSQL_ATTR_DIRECT_QUERY);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_FOUND_ROWS", MySQLPDODriver.MYSQL_ATTR_FOUND_ROWS);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_IGNORE_SPACE", MySQLPDODriver.MYSQL_ATTR_IGNORE_SPACE);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_COMPRESS", MySQLPDODriver.MYSQL_ATTR_COMPRESS);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_SSL_CA", MySQLPDODriver.MYSQL_ATTR_SSL_CA);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_SSL_CAPATH", MySQLPDODriver.MYSQL_ATTR_SSL_CAPATH);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_SSL_CERT", MySQLPDODriver.MYSQL_ATTR_SSL_CERT);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_CIPHER", MySQLPDODriver.MYSQL_ATTR_CIPHER);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_KEY", MySQLPDODriver.MYSQL_ATTR_KEY);
        }
Esempio n. 3
0
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;
            ZipConfiguration.RegisterLegacyOptions();

            StreamWrapper.RegisterSystemWrapper(new ZipStreamWrapper());
        }
Esempio n. 4
0
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PhpFilter.AddSystemFilter(new ZlibFilterFactory());

            StreamWrapper.SystemStreamWrappers.Add(ZlibStreamWrapper.scheme, new ZlibStreamWrapper());

            ZlibConfiguration.RegisterLegacyOptions();
        }
Esempio n. 5
0
        /// <summary>
        /// Called by the loader.
        /// Thread unsafe. Has to be called only in a critical section preventing any other calls.
        /// </summary>
        internal PhpLibraryAssembly(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly,
                                    PhpLibraryAttribute /*!*/ properties, LibraryConfigStore configStore)
            : base(applicationContext, realAssembly)
        {
            Debug.Assert(applicationContext != null && realAssembly != null && properties != null);

            this.properties = properties;

            if (properties.IsPure)
#if SILVERLIGHT
            { throw new NotSupportedException("Loading of pure PHP Libraries on Silverlight is not supported!"); }
#else
            { this.module = new PureModule(this); }
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PDOSQLiteConfiguration.RegisterLegacyOptions();

            PDOLibraryDescriptor.RegisterProvider(new SQLitePDODriver());

            var tPDO = Core.Reflection.DTypeDesc.Create(typeof(PDO));
            PhpMemberAttributes att = PhpMemberAttributes.Public | PhpMemberAttributes.Static;

            ApplicationContext.Default.AddMethodToType(tPDO, att, "sqliteCreateFunction", SQLitePDODriver.PDO_sqliteCreateFunction);
        }
Esempio n. 7
0
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PDOSQLiteConfiguration.RegisterLegacyOptions();

            PDOLibraryDescriptor.RegisterProvider(new SQLitePDODriver());

            string fullname = typeof(PDO).Name;
            DType  tPDO     = ApplicationContext.Default.GetType(new QualifiedName(new Name(typeof(PDO).FullName)), ref fullname);

            Core.Reflection.PhpMemberAttributes att = Core.Reflection.PhpMemberAttributes.Public | Core.Reflection.PhpMemberAttributes.Static;
            ApplicationContext.Default.AddMethodToType(tPDO.TypeDesc, att, "sqliteCreateFunction", SQLitePDODriver.PDO_sqliteCreateFunction);
        }
Esempio n. 8
0
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PDOMySQLConfiguration.RegisterLegacyOptions();

            PDOLibraryDescriptor.RegisterProvider(new MySQLPDODriver());

            //var pdoDType = DTypeDesc.Create(typeof(PDO));
            //Core.Reflection.PhpMemberAttributes att = Core.Reflection.PhpMemberAttributes.Public | Core.Reflection.PhpMemberAttributes.Static;
            ////ApplicationContext.Default.AddMethodToType(pdoDType, att, "sqliteCreateFunction", MySQLPDODriver.PDO_sqliteCreateFunction);
            ////ApplicationContext.Default.AddConstantToType(pdoDType, PhpMemberAttributes.Public | PhpMemberAttributes.Static, "MYSQL_ATTR_INIT_COMMAND", 1002);
            //ApplicationContext.Default.AddConstantToType(pdoDType, PhpMemberAttributes.Public | PhpMemberAttributes.Static, "MYSQL_ATTR_USE_BUFFERED_QUERY", 1000);
        }
Esempio n. 9
0
        /// <summary>
        /// Called by the loader.
        /// </summary>
        internal static DAssembly /*!*/ CreateNoLock(ApplicationContext /*!*/ applicationContext,
                                                     Assembly /*!*/ realAssembly, LibraryConfigStore config)
        {
            // gets a name of the descriptor:
            DAssemblyAttribute attr = DAssemblyAttribute.Reflect(realAssembly);

            if (attr != null)
            {
                PhpLibraryAttribute      lib;
                PurePhpAssemblyAttribute pure;

                if ((lib = attr as PhpLibraryAttribute) != null)
                {
                    // PHP library or extension:
                    return(new PhpLibraryAssembly(applicationContext, realAssembly, lib, config));
                }
                else if ((pure = attr as PurePhpAssemblyAttribute) != null)
                {
#if SILVERLIGHT
                    throw new NotSupportedException("Loading of pre-compiled pure assemblies is not supported!");
#else
                    // compiled pure PHP assembly:
                    return(new PureAssembly(applicationContext, realAssembly, pure, config));
#endif
                }
                else
                {
#if SILVERLIGHT
                    throw new NotSupportedException("Loading of pre-compiled script assemblies is not supported!");
#else
                    // compiled PHP script assembly:
                    return(ScriptAssembly.Create(applicationContext, realAssembly, (ScriptAssemblyAttribute)attr));
#endif
                }
            }
            else
            {
                // plugin assembly:
                var plugs = PluginAssemblyAttribute.Reflect(realAssembly);
                if (plugs != null)
                {
                    return(new PluginAssembly(applicationContext, realAssembly, config, plugs));
                }

                // CLR assembly:
                return(new ClrAssembly(applicationContext, realAssembly, config));
            }
        }
Esempio n. 10
0
        ///// <summary>
        ///// Gets a list of implemented extensions.
        ///// </summary>
        //public override string[] ImplementedExtensions
        //{
        //    get { return new string[] { ExtStandard, ExtCore,/* ExtCalendar,*/ ExtCType, ExtSession, ExtTokenizer, ExtDate, ExtPcre, ExtEreg, ExtJson, ExtHash, ExtSpl }; }
        //}

        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore config)
        {
            base.Loaded(assemblyAttribute, config);
            singleton = this;

#if !SILVERLIGHT
            LibraryConfiguration.RegisterLegacyOptions();

            // registers session handlers:
            SessionHandlers.RegisterHandler(PhpSessionHandler.Default);
            SessionHandlers.RegisterHandler(PhpUserSessionHandler.Default);
            SessionHandlers.RegisterHandler(AspNetThruSessionHandler.Default);

            // registers serializers:
            Serializers.RegisterSerializer(PhpSerializer.Default);
            //Serializers.RegisterSerializer(PhalangerSerializer.Default);
            Serializers.RegisterSerializer(new ContextualSerializer("dotnet", delegate(PHP.Core.Reflection.DTypeDesc caller /*ignored*/)
            {
                return(new BinaryFormatter(
                           null,
                           new StreamingContext(StreamingContextStates.Persistence, new SerializationContext())));
            }));
#endif
        }
Esempio n. 11
0
 /// <summary>
 /// Called by the loader.
 /// </summary>
 internal ClrAssembly(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly,
                      LibraryConfigStore configStore)
     : base(applicationContext, realAssembly)
 {
     this.module = new ClrModule(this);
 }
Esempio n. 12
0
        ///// <summary>
        ///// Gets a list of implemented extensions.
        ///// </summary>
        //public override string[] ImplementedExtensions
        //{
        //    get { return new string[] { SimpleXmlExtensionName, DomExtensionName, XslExtensionName }; }
        //}

        //internal const string SimpleXmlExtensionName = "SimpleXML";
        //internal const string DomExtensionName = "dom";
        //internal const string XslExtensionName = "xsl";

        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;
        }
Esempio n. 13
0
 /// <summary>
 /// Called by the loader.
 /// </summary>
 internal PluginAssembly(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly,
                         LibraryConfigStore configStore, IEnumerable <PluginAssemblyAttribute> /*!*/ attrs)
     : base(applicationContext, realAssembly)
 {
     this.module = new PluginModule(this);
 }
Esempio n. 14
0
		/// <summary>
		/// Used by the loader.
		/// </summary>
		internal PureAssembly(ApplicationContext/*!*/ applicationContext, Assembly/*!*/ realAssembly,
			PurePhpAssemblyAttribute/*!*/ attribute, LibraryConfigStore configStore)
			: base(applicationContext, realAssembly)
		{
			module = new PureModule(this);
		}
Esempio n. 15
0
 /// <summary>
 /// Used by the loader.
 /// </summary>
 internal PureAssembly(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly,
                       PurePhpAssemblyAttribute /*!*/ attribute, LibraryConfigStore configStore)
     : base(applicationContext, realAssembly)
 {
     module = new PureModule(this);
 }