private function allowed_term_ids($age) { $s = $this->settings(); $allowed = []; foreach ($s['term_ages'] as $id => $min_age) { if ((int) $min_age <= (int) $age) { $allowed[] = (int) $id; } } return $allowed; } public function filter_queries($query) { if ( (is_admin() && !(defined('DOING_AJAX') && DOING_AJAX)) || !($query instanceof WP_Query) || !$this->read_age() ) { return; } $s = $this->settings(); if ( empty($s['taxonomy']) || empty($s['post_types']) || empty($s['term_ages']) ) { return; } $pt = $query->get('post_type'); if ($pt === 'any') { $pt = $s['post_types']; $query->set('post_type', $pt); } elseif (empty($pt)) { if (!$query->is_main_query()) { return; } $pt = ['post']; } $pts = (array) $pt; if (!array_intersect($pts, $s['post_types'])) { return; } $age = (int) $this->read_age(); $allowed = []; $blocked = []; $mapped_ids = []; foreach ($s['term_ages'] as $term_id => $min_age) { $term_id = (int) $term_id; $min_age = (int) $min_age; $mapped_ids[] = $term_id; if ($min_age <= $age) { $allowed[] = $term_id; } else { $blocked[] = $term_id; } } if (!empty($s['block_unrated'])) { $all_terms = get_terms([ 'taxonomy' => $s['taxonomy'], 'hide_empty' => false, 'fields' => 'ids' ]); if (!is_wp_error($all_terms)) { $unmapped = array_diff( array_map('intval', $all_terms), $mapped_ids ); $blocked = array_merge($blocked, $unmapped); } } if (empty($allowed) && !empty($s['block_unrated'])) { $query->set('post__in', [0]); return; } $age_tax_query = [ 'relation' => 'AND' ]; if (!empty($allowed)) { $age_tax_query[] = [ 'taxonomy' => $s['taxonomy'], 'field' => 'term_id', 'terms' => $allowed, 'operator' => 'IN' ]; } if (!empty($blocked)) { $age_tax_query[] = [ 'taxonomy' => $s['taxonomy'], 'field' => 'term_id', 'terms' => array_values(array_unique($blocked)), 'operator' => 'NOT IN' ]; } $existing_tax_query = $query->get('tax_query'); if (!empty($existing_tax_query)) { $final_tax_query = [ 'relation' => 'AND', $existing_tax_query, $age_tax_query ]; } else { $final_tax_query = $age_tax_query; } $query->set('tax_query', $final_tax_query); }
واندرلند یک هوش مصنوعی است که به افراد امکان برقراری تماس تصویری شبیه سازی شده با عزیزان از دست رفته شان را می دهد. یک خانم مهماندار هواپیما می خواهد نامزد به کما رفته اش را ببیند و پدری دوست دارد با دختر فوت شده اش صحبت کند.
هنوز نظری ثبت نشده است.
اولین نفری باشید که نظر خود را ثبت میکند.