New contact form with friendlycaptcha

This commit is contained in:
Jorit Tijsen
2026-02-24 14:04:04 +01:00
parent 6786ac7ce1
commit 3b4030113b
80 changed files with 2860 additions and 1918 deletions

View File

@@ -18,40 +18,37 @@ use Nette;
* @property int $page
* @property-read int $firstPage
* @property-read int|null $lastPage
* @property-read int $firstItemOnPage
* @property-read int $lastItemOnPage
* @property-read int<0,max> $firstItemOnPage
* @property-read int<0,max> $lastItemOnPage
* @property int $base
* @property-read bool $first
* @property-read bool $last
* @property-read int|null $pageCount
* @property int $itemsPerPage
* @property int|null $itemCount
* @property-read int $offset
* @property-read int|null $countdownOffset
* @property-read int $length
* @property-read int<0,max>|null $pageCount
* @property positive-int $itemsPerPage
* @property int<0,max>|null $itemCount
* @property-read int<0,max> $offset
* @property-read int<0,max>|null $countdownOffset
* @property-read int<0,max> $length
*/
class Paginator
{
use Nette\SmartObject;
/** @var int */
private $base = 1;
private int $base = 1;
/** @var int */
private $itemsPerPage = 1;
/** @var positive-int */
private int $itemsPerPage = 1;
/** @var int */
private $page = 1;
private int $page = 1;
/** @var int|null */
private $itemCount;
/** @var int<0, max>|null */
private ?int $itemCount = null;
/**
* Sets current page number.
* @return static
*/
public function setPage(int $page)
public function setPage(int $page): static
{
$this->page = $page;
return $this;
@@ -89,6 +86,7 @@ class Paginator
/**
* Returns the sequence number of the first element on the page
* @return int<0, max>
*/
public function getFirstItemOnPage(): int
{
@@ -100,6 +98,7 @@ class Paginator
/**
* Returns the sequence number of the last element on the page
* @return int<0, max>
*/
public function getLastItemOnPage(): int
{
@@ -109,9 +108,8 @@ class Paginator
/**
* Sets first page (base) number.
* @return static
*/
public function setBase(int $base)
public function setBase(int $base): static
{
$this->base = $base;
return $this;
@@ -129,6 +127,7 @@ class Paginator
/**
* Returns zero-based page number.
* @return int<0, max>
*/
protected function getPageIndex(): int
{
@@ -161,6 +160,7 @@ class Paginator
/**
* Returns the total number of pages.
* @return int<0, max>|null
*/
public function getPageCount(): ?int
{
@@ -172,9 +172,8 @@ class Paginator
/**
* Sets the number of items to display on a single page.
* @return static
*/
public function setItemsPerPage(int $itemsPerPage)
public function setItemsPerPage(int $itemsPerPage): static
{
$this->itemsPerPage = max(1, $itemsPerPage);
return $this;
@@ -183,6 +182,7 @@ class Paginator
/**
* Returns the number of items to display on a single page.
* @return positive-int
*/
public function getItemsPerPage(): int
{
@@ -192,9 +192,8 @@ class Paginator
/**
* Sets the total number of items.
* @return static
*/
public function setItemCount(?int $itemCount = null)
public function setItemCount(?int $itemCount = null): static
{
$this->itemCount = $itemCount === null ? null : max(0, $itemCount);
return $this;
@@ -203,6 +202,7 @@ class Paginator
/**
* Returns the total number of items.
* @return int<0, max>|null
*/
public function getItemCount(): ?int
{
@@ -212,6 +212,7 @@ class Paginator
/**
* Returns the absolute index of the first item on current page.
* @return int<0, max>
*/
public function getOffset(): int
{
@@ -221,6 +222,7 @@ class Paginator
/**
* Returns the absolute index of the first item on current page in countdown paging.
* @return int<0, max>|null
*/
public function getCountdownOffset(): ?int
{
@@ -232,6 +234,7 @@ class Paginator
/**
* Returns the number of items on current page.
* @return int<0, max>
*/
public function getLength(): int
{