/** * @param WP_Query $wp_query * @param WP_Query $_wp_query_back * @param WP_Query $saved_query * * @return array */ public function get_ls_translations($wp_query, $_wp_query_back, $saved_query) { list($taxonomy, $term_id) = $this->extract_tax_archive_data($wp_query); if ($taxonomy && $term_id) { if ($this->sitepress->is_translated_taxonomy($taxonomy)) { $icl_taxonomy = 'tax_' . $taxonomy; $trid = $this->term_translation->trid_from_tax_and_id($term_id, $taxonomy); $translations = $this->sitepress->get_element_translations($trid, $icl_taxonomy, false); } else { $translations[$this->sitepress->get_current_language()] = (object) array('translation_id' => 0, 'language_code' => $this->sitepress->get_default_language(), 'original' => 1, 'name' => $taxonomy, 'term_id' => $term_id); } } elseif ($wp_query->is_archive() && !empty($wp_query->posts)) { $translations = array(); } elseif ($wp_query->is_attachment()) { $trid = $this->post_translation->get_element_trid($wp_query->get_queried_object_id()); $translations = $this->sitepress->get_element_translations($trid, 'post_attachment'); } elseif ($wp_query->is_page() || 'page' === $this->wp_api->get_option('show_on_front') && (isset($saved_query->queried_object_id) && $saved_query->queried_object_id == $this->wp_api->get_option('page_on_front') || isset($saved_query->queried_object_id) && $saved_query->queried_object_id == $this->wp_api->get_option('page_for_posts'))) { $trid = $this->sitepress->get_element_trid($wp_query->get_queried_object_id(), 'post_page'); $translations = $this->sitepress->get_element_translations($trid, 'post_page'); } elseif ($wp_query->is_singular() && !empty($wp_query->posts) || isset($_wp_query_back->query['name']) && isset($_wp_query_back->query['post_type']) || isset($_wp_query_back->query['p'])) { $pid = !empty($saved_query->post->ID) ? $saved_query->post->ID : (!empty($saved_query->query['p']) ? $saved_query->query['p'] : 0); $trid = $this->post_translation->get_element_trid($pid); $post_type = get_post_type($pid); $translations = $this->sitepress->get_element_translations($trid, 'post_' . $post_type); } else { $wp_query->is_singular = false; $wp_query->is_archive = false; $wp_query->is_category = false; $wp_query->is_404 = true; $translations = null; } return array($translations, $wp_query); }
/** * @return array */ public function get_log_data() { return $this->wpml_wp_api->get_option($this->fetch_log_settings->get_pickup_logger_option(), array()); }