is_public() ) { return Plugin::languages()->default_slug(); } if ( null === $this->resolved ) { $uri = isset( $_SERVER['REQUEST_URI'] ) && is_string( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '/'; $this->resolved = $this->from_uri( $uri ); } return $this->resolved; } /** * The language an address belongs to. * * @param string $uri Request address, path first. * @return string */ public function from_uri( string $uri ): string { return Plugin::urls()->language_from_url( $uri ); } /** * Whether this is a visitor-facing page request. * * @return bool */ public function is_public(): bool { global $pagenow; $public = ! is_admin() && ! wp_doing_ajax() && ! wp_doing_cron() && ! ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ) && ! ( defined( 'REST_REQUEST' ) && constant( 'REST_REQUEST' ) ) && ! ( defined( 'XMLRPC_REQUEST' ) && constant( 'XMLRPC_REQUEST' ) ) && 'wp-login.php' !== $pagenow; return (bool) apply_filters( 'vabelon_request_is_public', $public ); } /** * The site's home address as stored, without a trailing slash. * * @return string */ public static function home(): string { $home = get_option( 'home', '' ); return rtrim( is_string( $home ) ? $home : '', '/' ); } }