Skip to content

Commit

Permalink
Space after NOT
Browse files Browse the repository at this point in the history
Signed-off-by: Paul de Wouters <paul@hmn.md>
  • Loading branch information
Paul de Wouters committed Jun 16, 2014
1 parent e33bbb4 commit c8965fb
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions wpthumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public function __construct( $file_path = null, $args = array() ) {
$this->setArgs( $args );
}

if ( $this->getFilePath() && !$this->errored() ) {
if ( $this->getFilePath() && ! $this->errored() ) {

if ( !file_exists( $this->getCacheFilePath() ) || !$this->args['cache'] ) {
if ( ! file_exists( $this->getCacheFilePath() ) || ! $this->args['cache'] ) {

$this->generateCacheFile();
}
Expand Down Expand Up @@ -140,7 +140,7 @@ public function setFilePath( $file_path ) {
}

// if it's a local path, lets check it now
if ( strpos( $this->file_path, '/' ) === 0 && strpos( $this->file_path, '//' ) !== 0 && !file_exists( $this->file_path ) ) {
if ( strpos( $this->file_path, '/' ) === 0 && strpos( $this->file_path, '//' ) !== 0 && ! file_exists( $this->file_path ) ) {
$this->error = new WP_Error( 'file-not-found' );
}
}
Expand Down Expand Up @@ -215,13 +215,13 @@ public function setArgs( $args ) {
*/
public function getFilePath() {

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

if ( strpos( $this->file_path, '/' ) === 0 && !file_exists( $this->file_path ) && $this->args['default'] ) {
if ( strpos( $this->file_path, '/' ) === 0 && ! file_exists( $this->file_path ) && $this->args['default'] ) {
$this->file_path = $this->args['default'];
} elseif ( ( !$this->file_path ) && $this->args['default'] && file_exists( $this->args['default'] ) ) {
} elseif ( ( ! $this->file_path ) && $this->args['default'] && file_exists( $this->args['default'] ) ) {
$this->file_path = $this->args['default'];
}

Expand Down Expand Up @@ -250,7 +250,6 @@ public function getArgs() {
* @access public
*
* @param string $arg
*
* @return mixed
*/
public function getArg( $arg ) {
Expand All @@ -272,7 +271,7 @@ public function getFileExtension() {

$ext = pathinfo( $this->getFilePath(), PATHINFO_EXTENSION );

if ( !$ext ) {
if ( ! $ext ) {
// Seems like we dont have an ext, lets guess at JPG
$ext = 'jpg';
}
Expand All @@ -291,7 +290,7 @@ public function getCacheFilePath() {

$path = $this->getFilePath();

if ( !$path ) {
if ( ! $path ) {
return '';
}

Expand All @@ -312,8 +311,9 @@ public function getCacheFileDirectory() {

$path = $this->getFilePath();

if ( !$path )
if ( ! $path ) {
return '';
}

$original_filename = basename( $this->getFilePath() );

Expand Down Expand Up @@ -343,7 +343,7 @@ public function getCacheFileDirectory() {

$parts = parse_url( $this->getFilePath() );

if ( !empty( $parts['host'] ) )
if ( ! empty( $parts['host'] ) )
$new_dir = $upload_dir['basedir'] . '/cache/remote/' . sanitize_title( $parts['host'] );

else
Expand All @@ -369,7 +369,7 @@ public function getCacheFileName() {

$path = $this->getFilePath();

if ( !$path )
if ( ! $path )
return '';

// Generate a short unique filename
Expand Down Expand Up @@ -429,9 +429,9 @@ public function generateCacheFile() {

// Pass the new file back through the function so they are resized
return new WP_Thumb( $new_filepath, array_merge( $this->args, array(
'output_file' => $new_filepath,
'cache' => false
) ) );
'output_file' => $new_filepath,
'cache' => false
) ) );

endif;

Expand Down Expand Up @@ -527,7 +527,7 @@ private function crop_from_position( $editor, $width, $height, $position, $resiz
* @return null
*/
public function errored() {
return !empty( $this->error );
return ! empty( $this->error );
}

/**
Expand Down Expand Up @@ -578,7 +578,6 @@ public function getFileURL() {
* Convert a path into a url
*
* @param string $path
*
* @return string url
*/
private function getFileURLForFilePath( $path ) {
Expand All @@ -604,7 +603,6 @@ private function getFileURLForFilePath( $path ) {
* @param int $width .
* @param int $height .
* @param bool $crop . (default: false)
*
* @return (string) url to the image
*/
function wpthumb( $url, $args = array() ) {
Expand All @@ -624,7 +622,6 @@ function wpthumb( $url, $args = array() ) {
* @param null $null
* @param int $id
* @param array $args
*
* @return null
*/
function wpthumb_post_image( $null, $id, $args ) {
Expand All @@ -641,7 +638,7 @@ function wpthumb_post_image( $null, $id, $args ) {

$args = wp_parse_args( $args );

if ( empty( $args[0] ) )
if ( empty( $args[0] ) )
$args['width'] = $args[0];

if ( ! empty( $args[1] ) )
Expand Down Expand Up @@ -716,7 +713,6 @@ function wpthumb_delete_cache_for_file( $file ) {
* Removes a dir tree. I.e. recursive rmdir
*
* @param string $dir
*
* @return bool - success / failure
*/
function wpthumb_rmdir_recursive( $dir ) {
Expand Down Expand Up @@ -776,4 +772,5 @@ function wpthumb_add_image_editors( $editors ) {

return $editors;
}

add_filter( 'wp_image_editors', 'wpthumb_add_image_editors' );

0 comments on commit c8965fb

Please sign in to comment.