Commit dd689bd2 authored by zscott's avatar zscott
Browse files

PR feedback

changed constant names
added doc for filter s3_uploads_putObject_params
parent b108dbf9
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -20,29 +20,31 @@ class S3_Uploads_Stream_Wrapper extends Aws\S3\StreamWrapper {
	// Override
	public function stream_flush() {

		// Add some HTTP headers which can be defined in wp-config.php

		// Expires:
		if ( defined( 'S3_UPLOADS_EXPIRES' ) ) {
			$this->params[ 'Expires' ] = S3_UPLOADS_EXPIRES;
		/// Expires:
		if ( defined( 'S3_UPLOADS_HTTP_EXPIRES' ) ) {
			$this->params[ 'Expires' ] = S3_UPLOADS_HTTP_EXPIRES;
		}

		// Cache-Control:
		if ( defined( 'S3_UPLOADS_CACHE_CONTROL' ) ) {
			if ( is_numeric( S3_UPLOADS_CACHE_CONTROL ) ) {
				$this->params[ 'CacheControl' ] = 'max-age='. S3_UPLOADS_CACHE_CONTROL;
		if ( defined( 'S3_UPLOADS_HTTP_CACHE_CONTROL' ) ) {
			if ( is_numeric( S3_UPLOADS_HTTP_CACHE_CONTROL ) ) {
				$this->params[ 'CacheControl' ] = 'max-age='. S3_UPLOADS_HTTP_CACHE_CONTROL;
			} else {
				$this->params[ 'CacheControl' ] = S3_UPLOADS_CACHE_CONTROL;
				$this->params[ 'CacheControl' ] = S3_UPLOADS_HTTP_CACHE_CONTROL;
			}
		}

		// Theses are the parameters passed to S3Client::putObject()
		// http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.S3.S3Client.html#_putObject
		/**
		 * Filter the parameters passed to S3
		 * Theses are the parameters passed to S3Client::putObject()
		 * See; http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.S3.S3Client.html#_putObject
		 *
		 * @param array $params S3Client::putObject paramteres.
		 */
		$this->params = apply_filters( 's3_uploads_putObject_params', $this->params );

		parent::stream_flush();
		return parent::stream_flush();

		return;
	}

	public function stream_metadata( $path, $option, $value ) {