mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-17 03:03:26 +02:00
Add optional $return = false parameter to the csrf function
This commit is contained in:
@@ -27,8 +27,14 @@ class CsrfToken
|
||||
* @static true
|
||||
* @return void
|
||||
**/
|
||||
public static function create(): void {
|
||||
echo '<input type="hidden" name="csrf_token" value="' . self::get() . '" />';
|
||||
public static function create(bool $return = false): string {
|
||||
$input = '<input type="hidden" name="csrf_token" value="' . self::get() . '" />';
|
||||
if ($return) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
echo $input;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user