Derived from StreamWrapper, this class provides access to the local filesystem files.
The virtual working directory is handled by the PhpPath class in the Class Library. The absolute path resolution (using the working diretory and the include_path if necessary) and open-basedir check is performed by the PhpStream.ResolvePath method. This wrapper expects the path to be an absolute local filesystem path without the file:// scheme specifier.
상속: StreamWrapper
예제 #1
0
        ///// <summary>
        ///// Gets the list of user wrapper schemes.
        ///// </summary>
        ///// <returns></returns>
        //public static ICollection<string> GetUserWrapperSchemes()
        //{
        //    if (UserWrappers == null)
        //        return Core.Utilities.ArrayUtils.EmptyStrings;

        //    return UserWrappers.Keys;
        //}

        /// <summary>
        /// Search the lists of registered StreamWrappers to find the
        /// appropriate wrapper for a given scheme. When the scheme
        /// is empty, the FileStreamWrapper is returned.
        /// </summary>
        /// <param name="ctx">Current runtime context.</param>
        /// <param name="scheme">The scheme portion of an URL.</param>
        /// <returns>A StreamWrapper associated with the given scheme.</returns>
        internal static StreamWrapper GetWrapperInternal(Context ctx, string scheme)
        {
            StreamWrapper result;

            // Note: FileStreamWrapper is returned both for "file" and for "".
            if (string.IsNullOrEmpty(scheme))
            {
                scheme = FileStreamWrapper.scheme;
            }

            // First search the system wrappers (always at least an empty Hashtable)
            if (!SystemStreamWrappers.TryGetValue(scheme, out result))
            {
                // Then look if the wrapper is implemented but not instantiated
                switch (scheme)
                {
                case FileStreamWrapper.scheme:
                    return((StreamWrapper)(SystemStreamWrappers[scheme] = new FileStreamWrapper()));
                    //case HttpStreamWrapper.scheme:
                    //    return (StreamWrapper)(SystemStreamWrappers[scheme] = new HttpStreamWrapper());
                    //case InputOutputStreamWrapper.scheme:
                    //    return (StreamWrapper)(SystemStreamWrappers[scheme] = new InputOutputStreamWrapper());
                }

                //// Next search the user wrappers (if present)
                //if (UserWrappers != null)
                //{
                //    UserWrappers.TryGetValue(scheme, out result);
                //}
            }

            //
            return(result);  // can be null
        }
예제 #2
0
        ///// <summary>
        ///// Gets the list of user wrapper schemes.
        ///// </summary>
        ///// <returns></returns>
        //public static ICollection<string> GetUserWrapperSchemes()
        //{
        //    if (UserWrappers == null)
        //        return Core.Utilities.ArrayUtils.EmptyStrings;

        //    return UserWrappers.Keys;
        //}

        /// <summary>
        /// Search the lists of registered StreamWrappers to find the 
        /// appropriate wrapper for a given scheme. When the scheme
        /// is empty, the FileStreamWrapper is returned.
        /// </summary>
        /// <param name="ctx">Current runtime context.</param>
        /// <param name="scheme">The scheme portion of an URL.</param>
        /// <returns>A StreamWrapper associated with the given scheme.</returns>
        internal static StreamWrapper GetWrapperInternal(Context ctx, string scheme)
        {
            StreamWrapper result;

            // Note: FileStreamWrapper is returned both for "file" and for "".
            if (string.IsNullOrEmpty(scheme))
            {
                scheme = FileStreamWrapper.scheme;
            }

            // First search the system wrappers (always at least an empty Hashtable)
            if (!SystemStreamWrappers.TryGetValue(scheme, out result))
            {

                // Then look if the wrapper is implemented but not instantiated
                switch (scheme)
                {
                    case FileStreamWrapper.scheme:
                        return (StreamWrapper)(SystemStreamWrappers[scheme] = new FileStreamWrapper());
                    //case HttpStreamWrapper.scheme:
                    //    return (StreamWrapper)(SystemStreamWrappers[scheme] = new HttpStreamWrapper());
                    //case InputOutputStreamWrapper.scheme:
                    //    return (StreamWrapper)(SystemStreamWrappers[scheme] = new InputOutputStreamWrapper());
                }

                //// Next search the user wrappers (if present)
                //if (UserWrappers != null)
                //{
                //    UserWrappers.TryGetValue(scheme, out result);
                //}
            }

            //
            return result;  // can be null
        }