| | |
| | | $args = $this->buildUploadArgs($request); |
| | | $data = $request->get_params(); |
| | | |
| | | |
| | | error_log('[UploadRoutes]:handleGroupingRequest: data'.print_r($data, true)); |
| | | error_log('[UploadRoutes]:handleGroupingRequest: args'.print_r($args, true)); |
| | | |
| | | error_log('get_file_params: '.print_r($files, true)); |
| | | global $_FILES; |
| | | error_log('Global Files: '.print_r($_FILES, true)); |
| | | |
| | | if (!$args['content'] || !$args['user'] || !$args['posts']) { |
| | | |
| | |
| | | } |
| | | |
| | | // Queue file upload operation |
| | | $operation_type = $this->determineOperationType($secured_data['files'][0] ?? []); |
| | | $operation_type = $this->determineOperationType($secured_files['files'][0] ?? []); |
| | | $chunkSize = 5; |
| | | if ($operation_type === 'video') { |
| | | $chunkSize = 1; |
| | |
| | | $created_posts = []; |
| | | $used_upload_ids = []; |
| | | |
| | | error_log('Processing Group Data: '.print_r($data, true)); |
| | | // Create posts from groups |
| | | foreach ($data['posts'] as $index => $post) { |
| | | $post_title = !empty($post['fields']['post_title']) |
| | | ? sanitize_text_field($post['fields']['post_title']) |
| | | : 'New ' . JVB_CONTENT[$content]['singular'] . ' ' . ($index + 1); |
| | | : 'New ' . JVB_CONTENT[$data['content']]['singular'] . ' ' . ($index + 1); |
| | | |
| | | $post_excerpt = !empty($post['fields']['post_excerpt']) |
| | | ? sanitize_textarea_field($post['fields']['post_excerpt']) |
| | |
| | | set_post_thumbnail($new_post_id, (int)$gallery_attachment_ids[0]); |
| | | array_shift($gallery_attachment_ids); |
| | | } |
| | | |
| | | error_log('Remaining Gallery images: '.print_r($gallery_attachment_ids, true)); |
| | | // Set gallery images |
| | | if (!empty($gallery_attachment_ids)) { |
| | | $meta = new MetaManager($new_post_id, 'post'); |