- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/component_ajax.php
- Класс: CComponentAjax
- Вызов: CComponentAjax::__isAjaxURL
function __isAjaxURL($url)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
if(preg_match("/^(#|mailto:|javascript:|callto:)/", $url))
return false;
if (strpos($url, '://') !== false)
return false;
$url = preg_replace('/#.*/', '', $url);
if (($this->arParams['SEF_MODE'] ?? null) === 'Y')
{
if ($url == POST_FORM_ACTION_URI)
return true;
$test_str = '/bitrix/urlrewrite.php?SEF_APPLICATION_CUR_PAGE_URL=';
if (strncmp($url, $test_str, 52) === 0)
{
$url = urldecode(mb_substr($url, 52));
}
$url = $this->__GetSEFRealUrl($url);
if ($url === false)
return false;
}
else
{
if (strpos($url, '?') !== false)
$url = mb_substr($url, 0, mb_strpos($url, '?'));
if (mb_substr($url, -4) != '.php')
{
if (mb_substr($url, -1) != '/')
$url .= '/';
$url .= 'index.php';
}
}
if (!$this->currentUrl)
{
$currentUrl = $APPLICATION->GetCurPage();
if (($this->arParams['SEF_MODE'] ?? null) === 'Y')
$currentUrl = $this->__getSEFRealUrl($currentUrl);
if (strpos($currentUrl, '?') !== false)
$currentUrl = mb_substr($currentUrl, 0, mb_strpos($currentUrl, '?'));
if (mb_substr($currentUrl, -4) != '.php')
{
if (mb_substr($currentUrl, -1) != '/')
$currentUrl .= '/';
$currentUrl .= 'index.php';
}
$this->currentUrl = $currentUrl;
$this->dirname_currentUrl = dirname($currentUrl);
$this->basename_currentUrl = basename($currentUrl);
}
$dirname = dirname($url);
if (
(
$dirname == $this->dirname_currentUrl
||
$dirname == ''
||
$dirname == '.'
)
&&
basename($url) == $this->basename_currentUrl
)
return true;
return false;
}