Skip to content

Commit

Permalink
refactor: certificate sample json (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
asheshmagar authored Dec 18, 2023
1 parent 53284cc commit 466de63
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 141 deletions.
18 changes: 5 additions & 13 deletions resources/masteriyo/certificate/sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,11 @@ function( $images, $file ) use ( $samples_dir, $base_url, $dir ) {
$image_file = $samples_dir . '/' . $dir . '/' . $file;
$image_url = $base_url . '/' . $dir . '/' . $file;
if ( is_file( $image_file ) && in_array( pathinfo( $file, PATHINFO_EXTENSION ), [ 'jpg', 'jpeg', 'png', 'gif' ] ) ) {
if ( false !== strpos( $file, 'background.png' ) ) {
$images[] = array(
'url' => $image_url,
'url_placeholder' => '"backgroundImageURL":"{{background.png}}"',
'id_placeholder' => '"backgroundImageID":{{background.png}}',
);
} else {
$images[] = [
'url' => $image_url,
'url_placeholder' => 'src="{{' . $file . '}}"',
'id_placeholder' => '"id":{{' . $file . '}}',
];
}
$images[] = [
'url' => $image_url,
'url_placeholder' => "{{{$file}}}",
'id_placeholder' => '{{' . str_replace( [ '.jpg', '.jpeg', '.png', '.gif' ], '', $file ) . '}}',
];
}
return $images;
},
Expand Down
Loading

0 comments on commit 466de63

Please sign in to comment.