code review (phpstan)
This commit is contained in:
parent
d65758cc69
commit
7b12eda8a5
@ -20,6 +20,9 @@ use Dotclear\Core\Frontend\Ctx;
|
|||||||
*/
|
*/
|
||||||
class FrontendBehaviors
|
class FrontendBehaviors
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param ArrayObject<string, mixed> $alias
|
||||||
|
*/
|
||||||
public static function templateCustomSortByAlias(ArrayObject $alias): void
|
public static function templateCustomSortByAlias(ArrayObject $alias): void
|
||||||
{
|
{
|
||||||
$alias['post'] = [
|
$alias['post'] = [
|
||||||
@ -81,6 +84,11 @@ class FrontendBehaviors
|
|||||||
App::frontend()->context()->__set('saba_options', $options);
|
App::frontend()->context()->__set('saba_options', $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ArrayObject<string, mixed> $params
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
public static function getPostsParams(ArrayObject $params): array
|
public static function getPostsParams(ArrayObject $params): array
|
||||||
{
|
{
|
||||||
if (!isset($params['sql'])) {
|
if (!isset($params['sql'])) {
|
||||||
@ -91,7 +99,7 @@ class FrontendBehaviors
|
|||||||
|
|
||||||
# retreive _GET
|
# retreive _GET
|
||||||
$qs = $_SERVER['QUERY_STRING'];
|
$qs = $_SERVER['QUERY_STRING'];
|
||||||
$qs = preg_replace('#(^|/)page/([0-9]+)#', '', $qs);
|
$qs = (string) preg_replace('#(^|/)page/([0-9]+)#', '', $qs);
|
||||||
parse_str($qs, $get);
|
parse_str($qs, $get);
|
||||||
|
|
||||||
# search string
|
# search string
|
||||||
@ -189,7 +197,11 @@ class FrontendBehaviors
|
|||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ajouter la condition "ou" à la recherche
|
/**
|
||||||
|
* Ajouter la condition "ou" à la recherche.
|
||||||
|
*
|
||||||
|
* @param ArrayObject<string, mixed> $p
|
||||||
|
*/
|
||||||
public static function coreBlogBeforeGetPosts(ArrayObject $p): void
|
public static function coreBlogBeforeGetPosts(ArrayObject $p): void
|
||||||
{
|
{
|
||||||
if (empty($p['search'])) {
|
if (empty($p['search'])) {
|
||||||
|
@ -15,6 +15,9 @@ use Dotclear\App;
|
|||||||
*/
|
*/
|
||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
public static function getSabaDefaultPostsOptions(): array
|
public static function getSabaDefaultPostsOptions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -29,6 +32,9 @@ class Utils
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public static function getSabaFormOptions(): array
|
public static function getSabaFormOptions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -38,6 +44,9 @@ class Utils
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public static function getSabaFormOrders(): array
|
public static function getSabaFormOrders(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -51,6 +60,9 @@ class Utils
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public static function getSabaFormAges(): array
|
public static function getSabaFormAges(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -62,6 +74,9 @@ class Utils
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public static function getSabaFormTypes(): array
|
public static function getSabaFormTypes(): array
|
||||||
{
|
{
|
||||||
$know = [
|
$know = [
|
||||||
|
@ -110,7 +110,7 @@ class Widgets
|
|||||||
$ct .= '<li><label><input name="q_order" type="radio" value="' .
|
$ct .= '<li><label><input name="q_order" type="radio" value="' .
|
||||||
$v . '" ' .
|
$v . '" ' .
|
||||||
($v == $saba_options['q_order'] ? 'checked="checked" ' : '') .
|
($v == $saba_options['q_order'] ? 'checked="checked" ' : '') .
|
||||||
'/> ' . Html::escapeHTML($k) . '</label></li>';
|
'/> ' . Html::escapeHTML((string) $k) . '</label></li>';
|
||||||
}
|
}
|
||||||
if (!empty($ct)) {
|
if (!empty($ct)) {
|
||||||
$ct .= '<li><label><input name="q_rev" type="checkbox" value="1" ' .
|
$ct .= '<li><label><input name="q_rev" type="checkbox" value="1" ' .
|
||||||
@ -132,7 +132,7 @@ class Widgets
|
|||||||
$ct .= '<li><label><input name="q_opt[]" type="checkbox" value="' .
|
$ct .= '<li><label><input name="q_opt[]" type="checkbox" value="' .
|
||||||
$v . '" ' .
|
$v . '" ' .
|
||||||
(in_array($v, $saba_options['q_opt']) ? 'checked="checked" ' : '') .
|
(in_array($v, $saba_options['q_opt']) ? 'checked="checked" ' : '') .
|
||||||
'/> ' . Html::escapeHTML($k) . '</label></li>';
|
'/> ' . Html::escapeHTML((string) $k) . '</label></li>';
|
||||||
}
|
}
|
||||||
if (!empty($ct)) {
|
if (!empty($ct)) {
|
||||||
$res .= $w->renderTitle(__('Filter options')) . sprintf('<ul>%s</ul>', $ct);
|
$res .= $w->renderTitle(__('Filter options')) . sprintf('<ul>%s</ul>', $ct);
|
||||||
@ -147,7 +147,7 @@ class Widgets
|
|||||||
$ct .= '<li><label><input name="q_age" type="radio" value="' .
|
$ct .= '<li><label><input name="q_age" type="radio" value="' .
|
||||||
$v . '" ' .
|
$v . '" ' .
|
||||||
($v == $saba_options['q_age'] ? 'checked="checked" ' : '') .
|
($v == $saba_options['q_age'] ? 'checked="checked" ' : '') .
|
||||||
'/> ' . Html::escapeHTML($k) . '</label></li>';
|
'/> ' . Html::escapeHTML((string) $k) . '</label></li>';
|
||||||
}
|
}
|
||||||
if (!empty($ct)) {
|
if (!empty($ct)) {
|
||||||
$res .= $w->renderTitle(__('Filter by age')) . sprintf('<ul>%s</ul>', $ct);
|
$res .= $w->renderTitle(__('Filter by age')) . sprintf('<ul>%s</ul>', $ct);
|
||||||
@ -166,7 +166,7 @@ class Widgets
|
|||||||
$ct .= '<li><label><input name="q_type[]" type="checkbox" value="' .
|
$ct .= '<li><label><input name="q_type[]" type="checkbox" value="' .
|
||||||
$v . '" ' .
|
$v . '" ' .
|
||||||
(in_array($v, $saba_options['q_type']) ? 'checked="checked" ' : '') .
|
(in_array($v, $saba_options['q_type']) ? 'checked="checked" ' : '') .
|
||||||
'/> ' . Html::escapeHTML($k) . '</label></li>';
|
'/> ' . Html::escapeHTML((string) $k) . '</label></li>';
|
||||||
}
|
}
|
||||||
if (!empty($ct)) {
|
if (!empty($ct)) {
|
||||||
$res .= $w->renderTitle(__('Filter by type')) . sprintf('<ul>%s</ul>', $ct);
|
$res .= $w->renderTitle(__('Filter by type')) . sprintf('<ul>%s</ul>', $ct);
|
||||||
@ -186,7 +186,7 @@ class Widgets
|
|||||||
$ct .= '<li><label><input name="q_cat[]" type="checkbox" value="' .
|
$ct .= '<li><label><input name="q_cat[]" type="checkbox" value="' .
|
||||||
$rs->f('cat_id') . '" ' .
|
$rs->f('cat_id') . '" ' .
|
||||||
(in_array($rs->f('cat_id'), $saba_options['q_cat']) ? 'checked="checked" ' : '') .
|
(in_array($rs->f('cat_id'), $saba_options['q_cat']) ? 'checked="checked" ' : '') .
|
||||||
'/> ' . Html::escapeHTML($rs->f('cat_title')) . '</label></li>';
|
'/> ' . Html::escapeHTML((string) $rs->f('cat_title')) . '</label></li>';
|
||||||
}
|
}
|
||||||
if (!empty($ct)) {
|
if (!empty($ct)) {
|
||||||
$res .= $w->renderTitle(__('Filter by category')) . sprintf('<ul>%s</ul>', $ct);
|
$res .= $w->renderTitle(__('Filter by category')) . sprintf('<ul>%s</ul>', $ct);
|
||||||
|
Loading…
Reference in New Issue
Block a user