Commit 8cf788b9 authored by Joe Hoyle's avatar Joe Hoyle
Browse files

Code formatting, rip the bandaid off in one go

parent 05e7837f
Loading
Loading
Loading
Loading
+76 −80
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class S3_Uploads_Local_Stream_Wrapper {
	 *
	 * @var resource
	 */
	public $handle = NULL;
	public $handle = null;

	/**
	 * Instance URI (stream).
@@ -64,7 +64,7 @@ class S3_Uploads_Local_Stream_Wrapper {
	 *   Returns a string representing a location suitable for writing of a file,
	 *   or FALSE if unable to write to the file such as with read-only streams.
	 */
	protected function getTarget($uri = NULL) {
	protected function getTarget( $uri = null ) {
		if ( ! isset( $uri ) ) {
			$uri = $this->uri;
		}
@@ -75,7 +75,7 @@ class S3_Uploads_Local_Stream_Wrapper {
		return trim( $target, '\/' );
	}

	static function getMimeType($uri, $mapping = NULL) {
	static function getMimeType( $uri, $mapping = null ) {

		$extension = '';
		$file_parts = explode( '.', basename( $uri ) );
@@ -102,7 +102,7 @@ class S3_Uploads_Local_Stream_Wrapper {
		$output = @chmod( $this->getLocalPath(), $mode );
		// We are modifying the underlying file here, so we have to clear the stat
		// cache so that PHP understands that URI has changed too.
		clearstatcache(TRUE, $this->getLocalPath());
		clearstatcache( true, $this->getLocalPath() );
		return $output;
	}

@@ -123,7 +123,7 @@ class S3_Uploads_Local_Stream_Wrapper {
	 *   path, as determined by the realpath() function. If $uri is set but not
	 *   valid, returns FALSE.
	 */
	protected function getLocalPath($uri = NULL) {
	protected function getLocalPath( $uri = null ) {
		if ( ! isset( $uri ) ) {
			$uri = $this->uri;
		}
@@ -133,7 +133,7 @@ class S3_Uploads_Local_Stream_Wrapper {
		$directory = realpath( $this->getDirectoryPath() );

		if ( ! $realpath || ! $directory || strpos( $realpath, $directory ) !== 0 ) {
			return FALSE;
			return false;
		}
		return $realpath;
	}
@@ -188,7 +188,7 @@ class S3_Uploads_Local_Stream_Wrapper {
			return flock( $this->handle, $operation );
		}

		return TRUE;
		return true;
	}

	/**
@@ -372,14 +372,12 @@ class S3_Uploads_Local_Stream_Wrapper {
			// $this->getLocalPath() fails if $uri has multiple levels of directories
			// that do not yet exist.
			$localpath = $this->getDirectoryPath() . '/' . $this->getTarget( $uri );
		}
		else {
		} else {
			$localpath = $this->getLocalPath( $uri );
		}
		if ( $options & STREAM_REPORT_ERRORS ) {
			return mkdir( $localpath, $mode, $recursive );
		}
		else {
		} else {
			return @mkdir( $localpath, $mode, $recursive );
		}
	}
@@ -401,8 +399,7 @@ class S3_Uploads_Local_Stream_Wrapper {
		$this->uri = $uri;
		if ( $options & STREAM_REPORT_ERRORS ) {
			return rmdir( $this->getLocalPath() );
		}
		else {
		} else {
			return @rmdir( $this->getLocalPath() );
		}
	}
@@ -428,8 +425,7 @@ class S3_Uploads_Local_Stream_Wrapper {
		// exist. This is consistent with PHP's plain filesystem stream wrapper.
		if ( $flags & STREAM_URL_STAT_QUIET || ! file_exists( $path ) ) {
			return @stat( $path );
		}
		else {
		} else {
			return stat( $path );
		}
	}
@@ -479,7 +475,7 @@ class S3_Uploads_Local_Stream_Wrapper {
		// We do not really have a way to signal a failure as rewinddir() does not
		// have a return value and there is no way to read a directory handler
		// without advancing to the next file.
		return TRUE;
		return true;
	}

	/**
@@ -494,6 +490,6 @@ class S3_Uploads_Local_Stream_Wrapper {
		closedir( $this->handle );
		// We do not really have a way to signal a failure as closedir() does not
		// have a return value.
		return TRUE;
		return true;
	}
}
+8 −8
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ class S3_Uploads_Stream_Wrapper extends Aws\S3\StreamWrapper {

		$mode_short = substr( $mode, 0, 1 );

		if ( $mode_short === 'r' || $mode_short === 'a' ) {
		if ( 'r' === $mode_short || 'a' === $mode_short ) {
			return $result;
		}

+38 −39
Original line number Diff line number Diff line
@@ -11,8 +11,7 @@ class S3_Uploads_UploadSyncBuilder extends Aws\S3\Sync\UploadSyncBuilder {
	 *
	 * @return AbstractSync
	 */
    public function build()
    {
	public function build() {
		$this->validateRequirements();
		$this->sourceConverter = $this->sourceConverter ?: $this->getDefaultSourceConverter();
		$this->targetConverter = $this->targetConverter ?: $this->getDefaultTargetConverter();
+5 −3
Original line number Diff line number Diff line
@@ -129,8 +129,9 @@ class S3_Uploads {

	public function get_original_upload_dir() {

		if ( empty( $this->original_upload_dir ) )
		if ( empty( $this->original_upload_dir ) ) {
			wp_upload_dir();
		}

		return $this->original_upload_dir;
	}
@@ -140,8 +141,9 @@ class S3_Uploads {
	 */
	public function s3() {

		if ( ! empty( $this->s3 ) )
		if ( ! empty( $this->s3 ) ) {
			return $this->s3;
		}

		$params = array();

+4 −4

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading