"UP~?"U`~?"Up~?U`DPU`q UPGU`pHUp`HpxUPtPJU<UP2FU<UP+UEpU pPJU<UP2PJU<U|0U>U|PjU> aA`_j aA0_jjj AP A AjPj A,jAALjLj0A"U@P?"U@`?5U>pUPPBPJU<UUp5U>ppU`PBPJU<U0UP+U EUpPBU`BPJU<P+U(EUpPBU`BPJU<UU|@wU>U|PjU>jhj?`jj?jj(Aj0jA"UPG?P+UIEUPPIBUp`ItPJUpI<UpI+pUP JpPJUJ< WU JpPJUJ<U`JpU`0KpUPKtPJUK<UK+pUPp@MppU`pPMpPJUM<UPM2FUM<PjUP>_j_jH1Aj`AA BBpBBB0jjXjj@j`AAAA"UP?"U@`?5UippUPpPJU<@UPuPJU<PU@bUp UFU>(R WU@pUpPBPJU<UpUPpUPPBU``BPJU<U`|0U>Uh|PjU>Gjj HjjAH!Bp!B8A8Ap BBBequestIsAjax() && $isRequestRefererFromAdminPanel ) { return $this->isAjaxRequestFromAdminPanel = true; } } return $this->isAjaxRequestFromAdminPanel = false; } private function isAjaxRequestFromFrontend(): bool { if ( ! is_null( $this->isAjaxRequestFromFrontend ) ) { return $this->isAjaxRequestFromFrontend; } return $this->isAjaxRequestFromFrontend = $this->getRequestIsAjax() && ! $this->isAjaxRequestFromAdminPanel(); } public function getRequestUrl(): string { return isset( $_SERVER['REQUEST_URI'] ) ? (string) $_SERVER['REQUEST_URI'] : ''; } public function getClientFrontendRequestUrl(): string { $url = $this->getRequestUrl(); // In case of Ajax/Rest requests the real url we want to track is on which the string was rendered. $refUrl = $this->getRequestRefererUrl(); if ( $this->getRequestIsAjax() ) { $url = strlen( $refUrl ) > 0 ? $refUrl : $url; } else if ( $this->getRequestIsRest() ) { $url = strlen( $refUrl ) > 0 ? $refUrl : $url; } return $url; } public function getRequestRefererUrl(): string { if ( ! is_null( $this->requestRefererUrl ) ) { return $this->requestRefererUrl; } $ref = wp_get_referer(); $url = parse_url($ref); if ( $url === false || !isset( $url['path'] ) ) { return $this->requestRefererUrl = ''; } return $this->requestRefererUrl = $url['path'] . (isset($url['query']) ? '?' . $url['query'] : ''); } public function getRequestIsAjax(): bool { if ( ! is_null( $this->requestIsAjax ) ) { return $this->requestIsAjax; } $this->requestIsAjax = wpml_is_ajax(); return $this->requestIsAjax; } public function getRequestIsRest(): bool { if ( ! is_null( $this->requestIsRest ) ) { return $this->requestIsRest; } $requestUrl = $this->getRequestUrl(); if ( strlen( $requestUrl ) === 0 ) { return $this->requestIsRest = false; } $restApiPrefix = trailingslashit( rest_get_url_prefix() ?? '' ); $withRestApiPrefix = strpos( $requestUrl, $restApiPrefix ) !== false; $withPlainPermalinks = isset( $_GET['rest_route'] ) && strpos( $_GET['rest_route'], '/', 0 ) === 0; $afterWpRestRequestInit = defined( 'REST_REQUEST' ) && REST_REQUEST; $this->requestIsRest = ( $withRestApiPrefix || $withPlainPermalinks || $afterWpRestRequestInit ); return $this->requestIsRest; } public function deleteCache() { $this->isToAdminPanelRequest = null; $this->isFrontendRequest = null; $this->isRestRequestFromAdminPanel = null; $this->isRestRequestFromFrontend = null; $this->isAjaxRequestFromAdminPanel = null; $this->isAjaxRequestFromFrontend = null; $this->requestIsRest = null; $this->requestIsAjax = null; $this->requestRefererUrl = null; } }