Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
AceZeroX committed Jan 11, 2019
1 parent 9cc3b44 commit 7de1dab
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions devices/DOSDrivers/Wordpress/door.php
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ function dosAction( $args )

$obj->{$mapping[$k]} = $o;
}
else if( $k == 'Image' && $data != '' && strstr( $data, 'http' ) )
else if( $k == 'Image' && $data != '' && ( strstr( $data, 'http' ) || strstr( substr( trim( $data ), 0, 2 ), '\\' ) ) )
{
if( $this->CurlUrlExists( trim( $data ), 'content_type=>image' ) )
{
Expand Down Expand Up @@ -1748,11 +1748,18 @@ function dosAction( $args )
$obj->categories = json_decode( '[{"id": "'.$file->parent.'"}]' );

// If image missing set parent image if defined ...

if( !$obj->images && $file->image )
{
$obj->images = $file->image;
}

if( !$obj->images && $file->parentimage )
{
if( isset( $file->parentimage->src ) )
{
$obj->images = $file->parentimage->src;
}
else
{
$obj->images = $file->parentimage;
}
}

//$Logger->log( '[[[[[[[[[[ Uploading ]]]]]]]]]] ' . print_r( $dta,1 ) . ' [] ' . print_r( $obj,1 ) );

Expand Down Expand Up @@ -2684,7 +2691,7 @@ private function CreateCategoryWP( $cat, $dta = false, $log = false )

$obj->{$mapping[$k]} = $o;
}
else if( $k == 'Image' && $data != '' && strstr( $data, 'http' ) )
else if( $k == 'Image' && $data != '' && ( strstr( $data, 'http' ) || strstr( substr( trim( $data ), 0, 2 ), '\\' ) ) )
{
if( $this->CurlUrlExists( trim( $data ), 'content_type=>image' ) )
{
Expand Down Expand Up @@ -2723,10 +2730,17 @@ private function CreateCategoryWP( $cat, $dta = false, $log = false )

// If image missing set parent image if defined ...

if( !$obj->image && $cat->image )
{
$obj->image = $cat->image;
}
if( !$obj->image && $cat->parentimage )
{
if( isset( $cat->parentimage->src ) )
{
$obj->image = $cat->parentimage->src;
}
else
{
$obj->image = $cat->parentimage;
}
}

if( isset( $obj->image ) )
{
Expand Down Expand Up @@ -3134,7 +3148,7 @@ function putFile( $path, $fileObject )

$obj->{$mapping[$k]} = $o;
}
else if( $k == 'Image' && $data != '' && strstr( $data, 'http' ) )
else if( $k == 'Image' && $data != '' && ( strstr( $data, 'http' ) || strstr( substr( trim( $data ), 0, 2 ), '\\' ) ) )
{
if( $this->CurlUrlExists( trim( $data ), 'content_type=>image' ) )
{
Expand Down Expand Up @@ -3203,6 +3217,19 @@ function putFile( $path, $fileObject )

$obj->categories = json_decode( '[{"id": "'.$file->parent.'"}]' );

// If image missing set parent image if defined ...

if( !$obj->images && $file->parentimage )
{
if( isset( $file->parentimage->src ) )
{
$obj->images = $file->parentimage->src;
}
else
{
$obj->images = $file->parentimage;
}
}

// TODO: temporary that it deletes and creates new images every prod update, perhaps work with ID here also instead of filename

Expand Down

0 comments on commit 7de1dab

Please sign in to comment.