diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:30:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:30:22 +0000 |
commit | 3094c54084a305de471e7a530468a5a3b3b34dc7 (patch) | |
tree | 0a5f62e9d1963d4f5715acefc2c8e6dad932eaaa /vendor/ipl/web | |
parent | Adding debian version 0.13.1-1. (diff) | |
download | icinga-php-library-3094c54084a305de471e7a530468a5a3b3b34dc7.tar.xz icinga-php-library-3094c54084a305de471e7a530468a5a3b3b34dc7.zip |
Merging upstream version 0.13.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/ipl/web')
-rw-r--r-- | vendor/ipl/web/phpstan-baseline-by-php-version.php | 12 | ||||
-rw-r--r-- | vendor/ipl/web/src/Compat/StyleWithNonce.php | 8 | ||||
-rw-r--r-- | vendor/ipl/web/src/Compat/ViewRenderer.php | 12 | ||||
-rw-r--r-- | vendor/ipl/web/src/Control/LimitControl.php | 6 | ||||
-rw-r--r-- | vendor/ipl/web/src/Control/PaginationControl.php | 9 | ||||
-rw-r--r-- | vendor/ipl/web/src/FormElement/TermInput.php | 6 |
6 files changed, 40 insertions, 13 deletions
diff --git a/vendor/ipl/web/phpstan-baseline-by-php-version.php b/vendor/ipl/web/phpstan-baseline-by-php-version.php new file mode 100644 index 0000000..05107df --- /dev/null +++ b/vendor/ipl/web/phpstan-baseline-by-php-version.php @@ -0,0 +1,12 @@ +<?php + +$includes = []; +if (PHP_VERSION_ID < 80000) { + $includes[] = __DIR__ . '/phpstan-baseline-7x.neon'; +} else { + $includes[] = __DIR__ . '/phpstan-baseline-8x.neon'; +} + +return [ + 'includes' => $includes +]; diff --git a/vendor/ipl/web/src/Compat/StyleWithNonce.php b/vendor/ipl/web/src/Compat/StyleWithNonce.php index f4c7185..8c1be31 100644 --- a/vendor/ipl/web/src/Compat/StyleWithNonce.php +++ b/vendor/ipl/web/src/Compat/StyleWithNonce.php @@ -2,6 +2,7 @@ namespace ipl\Web\Compat; +use Icinga\Application\Icinga; use Icinga\Application\Version; use Icinga\Util\Csp; use ipl\Web\Style; @@ -15,9 +16,10 @@ class StyleWithNonce extends Style public function getNonce(): ?string { if ($this->nonce === null) { - $this->nonce = version_compare(Version::VERSION, '2.12.0', '>=') - ? Csp::getStyleNonce() ?? '' - : ''; + $this->nonce = ''; + if (version_compare(Version::VERSION, '2.12.0', '>=') && Icinga::app()->isWeb()) { + $this->nonce = Csp::getStyleNonce() ?? ''; + } } return parent::getNonce(); diff --git a/vendor/ipl/web/src/Compat/ViewRenderer.php b/vendor/ipl/web/src/Compat/ViewRenderer.php index 48ddcc3..0eaa8dd 100644 --- a/vendor/ipl/web/src/Compat/ViewRenderer.php +++ b/vendor/ipl/web/src/Compat/ViewRenderer.php @@ -2,11 +2,16 @@ namespace ipl\Web\Compat; +use Icinga\Web\View; +use ipl\Html\HtmlDocument; use Zend_Controller_Action_Helper_ViewRenderer as Zf1ViewRenderer; use Zend_Controller_Action_HelperBroker as Zf1HelperBroker; class ViewRenderer extends Zf1ViewRenderer { + /** @var View */ + public $view; + /** * Inject the view renderer */ @@ -41,9 +46,10 @@ class ViewRenderer extends Zf1ViewRenderer */ public function render($action = null, $name = null, $noController = null) { - $view = $this->view; + /** @var HtmlDocument $document */ + $document = $this->view->document; - if ($view->document->isEmpty() || $this->getRequest()->getParam('error_handler') !== null) { + if ($document->isEmpty() || $this->getRequest()->getParam('error_handler') !== null) { parent::render($action, $name, $noController); return; @@ -53,7 +59,7 @@ class ViewRenderer extends Zf1ViewRenderer $name = $this->getResponseSegment(); } - $this->getResponse()->appendBody($view->document->render(), $name); + $this->getResponse()->appendBody($document->render(), $name); $this->setNoRender(); } diff --git a/vendor/ipl/web/src/Control/LimitControl.php b/vendor/ipl/web/src/Control/LimitControl.php index b390a0a..376d6be 100644 --- a/vendor/ipl/web/src/Control/LimitControl.php +++ b/vendor/ipl/web/src/Control/LimitControl.php @@ -119,5 +119,11 @@ class LimitControl extends CompatForm 'title' => t('Change item count per page'), 'value' => $limit ]); + + if ($this->url->hasParam(PaginationControl::DEFAULT_PAGE_PARAM)) { + $this->addElement('hidden', PaginationControl::DEFAULT_PAGE_PARAM, [ + 'value' => 1 + ]); + } } } diff --git a/vendor/ipl/web/src/Control/PaginationControl.php b/vendor/ipl/web/src/Control/PaginationControl.php index 00f5c20..e704829 100644 --- a/vendor/ipl/web/src/Control/PaginationControl.php +++ b/vendor/ipl/web/src/Control/PaginationControl.php @@ -17,6 +17,9 @@ use ipl\Web\Widget\Icon; */ class PaginationControl extends BaseHtmlElement { + /** @var string Default page parameter */ + public const DEFAULT_PAGE_PARAM = 'page'; + /** @var int Default maximum number of items which should be shown per page */ protected $defaultPageSize; @@ -467,10 +470,8 @@ class PaginationControl extends BaseHtmlElement 'title' => t('Go to page …') ]); - if (isset($currentPageNumber)) { - if ($currentPageNumber === 1 || $currentPageNumber === $this->getPageCount()) { - $select->add(Html::tag('option', ['disabled' => '', 'selected' => ''], '…')); - } + if ($currentPageNumber === 1 || $currentPageNumber === $this->getPageCount()) { + $select->add(Html::tag('option', ['disabled' => '', 'selected' => ''], '…')); } foreach (range(2, $this->getPageCount() - 1) as $page) { diff --git a/vendor/ipl/web/src/FormElement/TermInput.php b/vendor/ipl/web/src/FormElement/TermInput.php index 352cce4..184be1d 100644 --- a/vendor/ipl/web/src/FormElement/TermInput.php +++ b/vendor/ipl/web/src/FormElement/TermInput.php @@ -151,14 +151,14 @@ class TermInput extends FieldsetElement public function setValue($value) { - $recipients = $value; + $separatedTerms = $value; if (is_array($value)) { - $recipients = $value['value'] ?? ''; + $separatedTerms = $value['value'] ?? ''; parent::setValue($value); } $terms = []; - foreach ($this->parseValue($recipients) as $term) { + foreach ($this->parseValue((string) $separatedTerms) as $term) { $terms[] = new RegisteredTerm($term); } |