/** * Checks if a given $url points at the root page * * @param string $url * * @return bool * * @uses \WPML_Root_Page::is_root_page */ public function is_url_root_page($url) { $ret = false; if ($this->get_root_page_id()) { $ret = WPML_Root_Page::is_root_page($url); } return $ret; }
/** * @param $url * Filters links to the root page, so that they are displayed properly in the front-end. * * @return mixed */ public function filter_root_permalink($url) { global $wpml_url_converter; if (WPML_Root_Page::get_root_id() > 0 && WPML_Root_Page::is_root_page($url)) { $url_parts = parse_url($url); $query = isset($url_parts['query']) ? $url_parts['query'] : ''; $path = isset($url_parts['path']) ? $url_parts['path'] : ''; $slugs = array_filter(explode('/', $path)); $last_slug = array_pop($slugs); $new_url = $wpml_url_converter->get_abs_home(); $new_url = is_numeric($last_slug) ? trailingslashit(trailingslashit($new_url) . $last_slug) : $new_url; $query = self::unset_page_query_vars($query); $new_url = trailingslashit($new_url); $url = (bool) $query === true ? trailingslashit($new_url) . '?' . $query : $new_url; } return $url; }
/** * Checks if a given $url points at the root page * * @param string $url * * @return bool * * @uses \WPML_Root_Page::is_root_page */ public function is_url_root_page($url) { return WPML_Root_Page::is_root_page($url); }