Skip to content

Commit

Permalink
New release 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
franck-paul committed Oct 27, 2023
1 parent a6c960b commit 0a9dc26
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion _define.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'a11yConfig',
'Implements Access42 accessibility configuration tool',
'Franck Paul, Biou and contributors',
'5.0',
'5.1',
[
'requires' => [['core', '2.28']],
'permissions' => 'My',
Expand Down
8 changes: 4 additions & 4 deletions src/BackendBehaviors.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public static function adminBeforeUserOptionsUpdate(): string
$preferences->put('contrast', !empty($_POST['a11yc_contrast']), App::userWorkspace()::WS_BOOL);
$preferences->put('image', !empty($_POST['a11yc_image']), App::userWorkspace()::WS_BOOL);
}
} catch (Exception $e) {
App::error()->add($e->getMessage());
} catch (Exception $exception) {
App::error()->add($exception->getMessage());
}

return '';
Expand Down Expand Up @@ -134,7 +134,7 @@ public static function adminPreferencesForm(): string
$icons[] = (new Radio(['a11yc_icon', 'a11yc_icon_' . $i], $a11yc_icon == $k))
->value($k)
->label((new Label($v, Label::INSIDE_TEXT_AFTER)));
$i++;
++$i;
}

$positions = [];
Expand All @@ -143,7 +143,7 @@ public static function adminPreferencesForm(): string
$positions[] = (new Radio(['a11yc_position', 'a11yc_position_' . $i], $a11yc_position == $k))
->value($k)
->label((new Label($v, Label::INSIDE_TEXT_AFTER)));
$i++;
++$i;
}

echo
Expand Down
4 changes: 1 addition & 3 deletions src/FrontendHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class FrontendHelper
* @param int $icon The icon
* @param array<string, mixed> $params The parameters
* @param string $class The class
*
* @return string
*/
public static function render(?string $label, int $icon, array $params, string $class = ''): string
{
Expand All @@ -39,7 +37,7 @@ public static function render(?string $label, int $icon, array $params, string $
'Contrast' => true,
'ImageReplacement' => true,
];
$options = array_merge($options, $params);
$options = [...$options, ...$params];

$class .= match ($icon) {
Prepend::ICON_WHEELCHAIR => ($class !== '' ? ' ' : '') . 'a11yc-wc',
Expand Down
2 changes: 0 additions & 2 deletions src/FrontendTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class FrontendTemplate
{
/**
* @param array<string, mixed>|\ArrayObject<string, mixed> $attr The attribute
*
* @return string
*/
public static function tplAccessConfig(array|ArrayObject $attr): string
{
Expand Down
10 changes: 5 additions & 5 deletions src/FrontendWidgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public static function renderWidget(WidgetsElement $w): string
}

$params = [
'Font' => ($w->get('font') ? true : false),
'LineSpacing' => ($w->get('linespacing') ? true : false),
'Justification' => ($w->get('justification') ? true : false),
'Contrast' => ($w->get('contrast') ? true : false),
'ImageReplacement' => ($w->get('image') ? true : false),
'Font' => ((bool) $w->get('font')),
'LineSpacing' => ((bool) $w->get('linespacing')),
'Justification' => ((bool) $w->get('justification')),
'Contrast' => ((bool) $w->get('contrast')),
'ImageReplacement' => ((bool) $w->get('image')),
];

return FrontendHelper::render($w->get('buttonname'), (int) $w->get('icon'), $params, 'widget');
Expand Down
6 changes: 1 addition & 5 deletions src/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public static function init(): bool

public static function process(): bool
{
if (!self::status()) {
return false;
}

return true;
return (bool) self::status();
}
}
6 changes: 3 additions & 3 deletions src/Manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function process(): bool
return false;
}

if (!empty($_POST)) {
if ($_POST !== []) {
try {
$settings = My::settings();

Expand Down Expand Up @@ -119,7 +119,7 @@ public static function render(): void
$icons[] = (new Radio(['a11yc_icon', 'a11yc_icon_' . $i], $a11yc_icon == $k))
->value($k)
->label((new Label($v, Label::INSIDE_TEXT_AFTER)));
$i++;
++$i;
}

$positions = [];
Expand All @@ -128,7 +128,7 @@ public static function render(): void
$positions[] = (new Radio(['a11yc_position', 'a11yc_position_' . $i], $a11yc_position == $k))
->value($k)
->label((new Label($v, Label::INSIDE_TEXT_AFTER)));
$i++;
++$i;
}

$head = My::jsLoad('settings.js');
Expand Down
19 changes: 9 additions & 10 deletions src/Prepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
class Prepend extends Process
{
// Constants for position (public/admin)
public const IN_TOP = 0;
public const IN_BOTTOM = 1;
final public const IN_TOP = 0;

final public const IN_BOTTOM = 1;

// Constants for icon (public/admin)
public const ICON_NONE = 0;
public const ICON_WHEELCHAIR = 1;
public const ICON_VISUALDEFICIENCY = 2;
final public const ICON_NONE = 0;

final public const ICON_WHEELCHAIR = 1;

final public const ICON_VISUALDEFICIENCY = 2;

public static function init(): bool
{
Expand All @@ -34,10 +37,6 @@ public static function init(): bool

public static function process(): bool
{
if (!self::status()) {
return false;
}

return true;
return (bool) self::status();
}
}

0 comments on commit 0a9dc26

Please sign in to comment.