| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Templately\API; |
| 4 | 4 | |
| 5 | -use Templately\Core\Platform; | |
| 5 | +use Templately\Utils\Database; | |
| 6 | 6 | use WP_REST_Request; |
| 7 | 7 | |
| 8 | 8 | use function wp_slash; |
| 9 | 9 | use function json_encode; |
| @@ -203,11 +203,11 @@ | ||
| 203 | 203 | $file_content['version'] = ! empty( $file_content['version'] ) ? $file_content['version'] : ''; |
| 204 | 204 | $file_content['type'] = ! empty( $file_content['type'] ) ? $file_content['type'] : 'section'; |
| 205 | 205 | $file_content['title'] = ! empty( $file_content['title'] ) ? $file_content['title'] : \basename( $response['file_name'], '.json' ); |
| 206 | 206 | } |
| 207 | + | |
| 208 | + $file_content = json_encode( $file_content ); | |
| 207 | 209 | } |
| 208 | - | |
| 209 | - $file_content = is_array( $file_content ) ? json_encode( $file_content ) : $file_content; | |
| 210 | 210 | |
| 211 | 211 | $file_name = 'templately-tmp.json'; |
| 212 | 212 | $_temp_file_name = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $file_name; |
| 213 | 213 | $_temp_file_url = $upload_dir['baseurl'] . DIRECTORY_SEPARATOR . $file_name; |