mirror of
https://github.com/openvk/chandler.git
synced 2024-11-15 03:31:12 +03:00
Implement SimplePresenter::jsonParam
This commit is contained in:
parent
82da99937d
commit
9a14e22d89
1 changed files with 11 additions and 3 deletions
|
@ -33,7 +33,7 @@ abstract class SimplePresenter implements IPresenter
|
|||
if(file_exists($realpath)) {
|
||||
$hash = "sha384-" . base64_encode(hash_file("sha384", $realpath, true));
|
||||
$mod = base_convert((string) (filemtime($realpath)), 10, 32);
|
||||
echo "<link rel=\'stylesheet\' href=\'/assets/packages/static/$domain/$file?mod=$mod\' integrity=\'$hash\' />";
|
||||
echo "<link rel=\'stylesheet\' href=\'/assets/packages/static/$domain/$file?mod=$mod\' integrity=\'$hash\' crossorigin=\'anonymous\' />";
|
||||
} else {
|
||||
echo "<!-- ERR: $file does not exist. Not including. -->";
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ abstract class SimplePresenter implements IPresenter
|
|||
if(file_exists($realpath)) {
|
||||
$hash = "sha384-" . base64_encode(hash_file("sha384", $realpath, true));
|
||||
$mod = base_convert((string) (filemtime($realpath)), 10, 32);
|
||||
echo "<script src=\'/assets/packages/static/$domain/$file?mod=$mod\' integrity=\'$hash\'></script>";
|
||||
echo "<script src=\'/assets/packages/static/$domain/$file?mod=$mod\' integrity=\'$hash\' crossorigin=\'anonymous\' ></script>";
|
||||
} else {
|
||||
echo "<!-- ERR: $file does not exist. Not including. -->";
|
||||
}
|
||||
|
@ -176,7 +176,15 @@ abstract class SimplePresenter implements IPresenter
|
|||
|
||||
protected function requestParam(string $index): ?string
|
||||
{
|
||||
return $_REQUEST[$index];
|
||||
return $_REQUEST[$index] ?? NULL;
|
||||
}
|
||||
|
||||
protected function jsonParam(string $index): ?string
|
||||
{
|
||||
if(!isset($GLOBALS["jsonInputCache"]))
|
||||
$GLOBALS["jsonInputCache"] = json_decode($this->queryParam("js") ?? file_get_contents("php://input"), true);
|
||||
|
||||
return $GLOBALS["jsonInputCache"][$index] ?? NULL;
|
||||
}
|
||||
|
||||
protected function checkbox(string $name): bool
|
||||
|
|
Loading…
Reference in a new issue