mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-12 14:58:42 +00:00
Add downloadable+array query data
This commit is contained in:
parent
c111b2d432
commit
60685547b6
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\Message\Http;
|
namespace phpOMS\Message\Http;
|
||||||
|
|
||||||
use phpOMS\Message\HeaderAbstract;
|
use phpOMS\Message\HeaderAbstract;
|
||||||
|
use phpOMS\System\MimeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response class.
|
* Response class.
|
||||||
|
|
@ -86,6 +87,25 @@ final class Header extends HeaderAbstract
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set header as downloadable
|
||||||
|
*
|
||||||
|
* @param string $name Download name
|
||||||
|
* @param string $type Download file type
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function setDownloadable(string $name, string $type) : void
|
||||||
|
{
|
||||||
|
$this->set('Content-Type', MimeType::M_BIN, true);
|
||||||
|
$this->set('Content-Transfer-Encoding', 'Binary', true);
|
||||||
|
$this->set(
|
||||||
|
'Content-disposition', 'attachment; filename="' . $name . '.' . $type . '"'
|
||||||
|
, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is security header.
|
* Is security header.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,11 @@ final class Request extends RequestAbstract
|
||||||
UriFactory::setQuery('/lang', $this->header->getL11n()->getLanguage());
|
UriFactory::setQuery('/lang', $this->header->getL11n()->getLanguage());
|
||||||
|
|
||||||
foreach ($this->data as $key => $value) {
|
foreach ($this->data as $key => $value) {
|
||||||
UriFactory::setQuery('?' . $key, $value);
|
if (\is_array($value)) {
|
||||||
|
UriFactory::setQuery('?' . $key, \implode(',', $value));
|
||||||
|
} else {
|
||||||
|
UriFactory::setQuery('?' . $key, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user