getFromIndex example

/** * @return resource */
    public function getStream()
    {
        return $this->stream->getStream($this->name);
    }

    public function getContents()
    {
        return $this->stream->getFromIndex($this->position);
    }

    /** * @return bool */
    public function isDir()
    {
        return substr($this->name, -1) === '/';
    }

    /** * @return bool */


        if ( str_starts_with( $info['name'], '__MACOSX/' ) ) { // Don't extract the OS X-created __MACOSX directory files.             continue;
        }

        // Don't extract invalid files:         if ( 0 !== validate_file( $info['name'] ) ) {
            continue;
        }

        $contents = $z->getFromIndex( $i );

        if ( false === $contents ) {
            return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' )$info['name'] );
        }

        if ( ! $wp_filesystem->put_contents( $to . $info['name']$contents, FS_CHMOD_FILE ) ) {
            return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' )$info['name'] );
        }
    }

    $z->close();

    
/** * @return resource */
    public function getStream()
    {
        return $this->stream->getStream($this->name);
    }

    public function getContents()
    {
        return $this->stream->getFromIndex($this->position);
    }

    /** * @return bool */
    public function isDir()
    {
        return substr($this->name, -1) === '/';
    }

    /** * @return bool */
Home | Imprint | This part of the site doesn't use cookies.