| | |
| | | unset($context['upload_ids']); |
| | | |
| | | $config = $this->getFieldConfig($args); |
| | | error_log('secureFiles: '.print_r($files, true)); |
| | | $file_array = $files['files'] ?? $files; |
| | | $tmp_names = isset($file_array['tmp_name'][0]) && is_array($file_array['tmp_name'][0]) |
| | | ? $file_array['tmp_name'][0] |
| | |
| | | $args = $this->buildUploadArgs($request); |
| | | $data = $request->get_params(); |
| | | |
| | | 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']) { |
| | | |
| | |
| | | $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']) |
| | |
| | | $created_posts[] = $new_post_id; |
| | | |
| | | // Get featured image upload_id |
| | | $featured_upload_id = (int)$post['fields']['featured'] ?? null; |
| | | |
| | | |
| | | $featured_upload_id = array_key_exists('featured', $post['fields']) ? (int)$post['fields']['featured'] : null; |
| | | $featured_attachment_id = null; |
| | | $gallery_attachment_ids = []; |
| | | |
| | |
| | | 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'); |
| | |
| | | $used_upload_ids = []; |
| | | |
| | | $content = jvbCheckBase($data['content']); |
| | | error_log('[processTimelineUploads]Got content: '.print_r($content, true)); |
| | | |
| | | $config = Features::getConfig($content); |
| | | error_log('[processTimelineUploads]Got config: '.print_r($config, true)); |
| | | |
| | | $defaultTitle = 'New '.$config['singular']. ' '; |
| | | foreach ($data['posts'] as $index=> $post) { |
| | | $title = !empty($post['fields']['post_title']) |