self enable

This commit is contained in:
xiaomlove
2026-03-29 21:42:43 +07:00
parent af66ec806d
commit db4982f8f7
19 changed files with 165 additions and 12 deletions

View File

@@ -176,6 +176,22 @@ final class Nexus
return false;
}
public function isAjax(): bool
{
if ($this->getScript() == 'ajax') {
return true;
}
$ajax = $this->retrieveFromServer(['HTTP_X_REQUESTED_WITH'], true);
if (!empty($ajax) && strtolower($ajax) == 'xmlhttprequest') {
return true;
}
$json = $this->retrieveFromServer(['HTTP_ACCEPT'], true);
if (!empty($json) && strtolower($json) == 'application/json') {
return true;
}
return false;
}
private function generateRequestId(): string
{
$prefix = ($_SERVER['SCRIPT_FILENAME'] ?? '') . implode('', $_SERVER['argv'] ?? []);
@@ -426,4 +442,6 @@ final class Nexus
}
}