| | |
| | | $this->cache_name = 'feed'; |
| | | $this->cache_ttl = 86400; |
| | | parent::__construct(); |
| | | $this->cache->clear(); |
| | | if (JVB_TESTING) { |
| | | $this->cache->clear(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public function init():void |
| | | { |
| | | $this->cache->clear(); |
| | | $this->checker = Checker::getInstance(); |
| | | |
| | | if (Features::hasIntegration('umami')) { |
| | |
| | | protected function extractTaxonomies(array $fields, int $postID, string $content):array { |
| | | $taxonomies = []; |
| | | foreach ($fields as $key => $value) { |
| | | if (array_key_exists($key, JVB_TAXONOMY) && (array_key_exists('public', JVB_TAXONOMY[$key]) && JVB_TAXONOMY[$key]['public']!== false)) { |
| | | $terms = array_map('absint', explode(',',$value)); |
| | | foreach($terms as $termID) { |
| | | $term = get_term($termID, jvbCheckBase($key)); |
| | | if ($term && !is_wp_error($term)) { |
| | | $taxonomies[$key][$termID] = $this->formatTaxonomy($term, $postID, $content); |
| | | } |
| | | if (empty($value)) { |
| | | continue; |
| | | } |
| | | if (!array_key_exists($key, JVB_TAXONOMY)) { |
| | | continue; |
| | | } |
| | | |
| | | $taxConfig = JVB_TAXONOMY[$key]; |
| | | if (isset($taxConfig['public']) && $taxConfig['public'] === false) { |
| | | continue; |
| | | } |
| | | $terms = array_map('absint', explode(',', $value)); |
| | | $terms = array_filter($terms); // Remove 0 values |
| | | |
| | | if (empty($terms)) { |
| | | continue; |
| | | } |
| | | foreach($terms as $termID) { |
| | | $term = get_term($termID, jvbCheckBase($key)); |
| | | if ($term && !is_wp_error($term)) { |
| | | $taxonomies[$key][$termID] = $this->formatTaxonomy($term, $postID, $content); |
| | | } |
| | | } |
| | | } |
| | |
| | | $args = $this->applyOrderFilters($args, $data); |
| | | $args = $this->applyDateFilters($args, $data); |
| | | |
| | | $args = $this->applyFavouritesFilter($args, $data); |
| | | return $args; |
| | | return $this->applyFavouritesFilter($args, $data); |
| | | } |
| | | |
| | | protected function applyTaxonomyFilters(array $args, array $data): array |