| | |
| | | |
| | | use JVBase\managers\queue\{Executor, Operation, Progress, Result, Storage}; |
| | | use JVBase\meta\Meta; |
| | | use JVBase\utility\Features; |
| | | use JVBase\registrar\Registrar; |
| | | use Exception; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | |
| | | } |
| | | |
| | | $this->savePostFields((int)$id, $postData); |
| | | |
| | | if (Features::forContent($content)->has('is_timeline')) { |
| | | $registrar = Registrar::getInstance($content); |
| | | if ($registrar && $registrar->hasFeature('is_timeline')) { |
| | | $post = get_post((int)$id); |
| | | $parentId = $post->post_parent > 0 ? $post->post_parent : $post->ID; |
| | | $sharedFields = array_keys(array_filter(JVB_CONTENT[$content]['fields'], function ($field) { |
| | | $fields = $registrar->getFields(); |
| | | $sharedFields = array_keys(array_filter($fields, function ($field) { |
| | | return !array_key_exists('for_all', $field) || !$field['for_all']; |
| | | })); |
| | | |
| | |
| | | private function savePostFields(int $postId, array $postData): bool |
| | | { |
| | | $content = $postData['content'] ?? ''; |
| | | $fields = jvbGetFields($content); |
| | | $fields = Registrar::getFieldsFor($content); |
| | | |
| | | $allowedFields = array_filter($postData, function ($key) use ($fields) { |
| | | return array_key_exists($key, $fields); |