Skip to content

Commit d575479

Browse files
committed
1.2.0
1 parent 06479fa commit d575479

File tree

10 files changed

+132
-119
lines changed

10 files changed

+132
-119
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Extension for phpBB - Makes it possible to decide centrally for all extensions w
55

66
### Requirements
77
* phpBB 3.3.0 - 3.3.x
8-
* PHP 7.4.0 - 8.4.x
8+
* PHP 8.0.0 - 8.4.x

docs/version_check.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"security": false
88
},
99
"3.3": {
10-
"current": "1.1.1",
11-
"announcement": "https://github.com/LukeWCS/toggle-control/releases/tag/1.1.1",
10+
"current": "1.2.0",
11+
"announcement": "https://github.com/LukeWCS/toggle-control/releases/tag/1.2.0",
1212
"eol": null,
1313
"security": false
1414
}
Lines changed: 66 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,92 @@
1-
/* GENERAL */
1+
/* GENERAL > */
22

33
.togglectrl_footer {
44
margin-top: 1em;
55
text-align: center;
66
font-size: .75em;
77
}
88

9-
/* SETTINGS */
9+
/* < GENERAL */
1010

11-
fieldset legend {
12-
top: 0;
13-
margin-left: -11px;
14-
padding: 2px 10px;
15-
border-radius: 5px 5px 0 0;
16-
border-top: inherit;
17-
border-left: inherit;
18-
background-color: inherit;
19-
}
11+
/* SETTINGS > */
2012

21-
fieldset dt label {
22-
cursor: inherit;
23-
}
13+
fieldset {
14+
& legend {
15+
top: 0;
16+
margin-left: -11px;
17+
padding: 2px 10px;
18+
border-radius: 5px 5px 0 0;
19+
border-top: inherit;
20+
border-left: inherit;
21+
background-color: inherit;
22+
}
2423

25-
fieldset p.submit-buttons {
26-
margin-top: 0;
27-
padding: 0 4px 4px 4px;
28-
}
24+
& dt label {
25+
cursor: inherit;
26+
}
2927

30-
/*
31-
* phpBB ACP Toggles - A CSS class that makes it easy to display checkboxes as toggles.
32-
* Source : https://danklammer.com/articles/simple-css-toggle-switch/
33-
* Revision by: Kirk (customization and optimization), LukeWCS (optimization)
34-
*/
28+
& p.submit-buttons {
29+
margin-top: 0;
30+
padding: 0 4px 4px 4px;
31+
}
32+
}
3533

3634
.toggle {
37-
-webkit-appearance: none;
38-
-moz-appearance: none;
35+
/* phpBB Kirk Toggles 2.0 - A CSS class that makes it easy to display checkboxes as toggles.
36+
Source : https://danklammer.com/articles/simple-css-toggle-switch/
37+
Revision by: Kirk (customization and optimization), LukeWCS (optimization) */
38+
39+
/* Kirk style: */
40+
/* --background-transition: ease 0.3s; */
41+
/* --background-color-off: #a00; */
42+
/* --background-color-on: #3fa651; */
43+
/* --slider-transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s; */
44+
3945
appearance: none;
46+
position: relative;
4047
width: 38px;
4148
height: 17px;
42-
position: relative;
4349
border-radius: 50px;
4450
cursor: pointer;
4551
font-family: FontAwesome;
46-
transition: background-color 0.2s;
47-
}
52+
transition: var(--background-transition, 0.2s);
4853

49-
.toggle:before {
50-
position: absolute;
51-
width: 14px;
52-
height: 13px;
53-
background-color: #ffffff;
54-
top: 2px;
55-
border-radius: 50%;
56-
display: flex;
57-
justify-content: center;
58-
align-items: center;
59-
left: 22px;
60-
content: "\f00d";
61-
transition: 0.2s;
62-
}
54+
&,
55+
&:hover,
56+
&:focus {
57+
background: var(--background-color-off, #ccc);
58+
border: none;
59+
color: #000;
60+
}
6361

64-
.toggle,
65-
.toggle:hover,
66-
.toggle:focus {
67-
background-color: #cccccc;
68-
border: none;
69-
color: #000000;
70-
}
62+
&:before {
63+
content: "\f00d";
64+
justify-content: center;
65+
position: absolute;
66+
top: 2px;
67+
left: 22px;
68+
width: 14px;
69+
height: 13px;
70+
background: #fff;
71+
border-radius: 50%;
72+
display: flex;
73+
align-items: center;
74+
transition: var(--slider-transition, 0.2s);
75+
}
7176

72-
.toggle:checked {
73-
background-color: #3b87ab;
74-
}
77+
&:checked {
78+
background: var(--background-color-on, #3b87ab);
7579

76-
.toggle:checked:before {
77-
left: 2px;
78-
content: "\f00c";
80+
&:before {
81+
content: "\f00c";
82+
left: 2px;
83+
}
84+
}
7985
}
8086

81-
/* RESPONSIVE */
87+
/* < SETTINGS */
88+
89+
/* RESPONSIVE > */
8290

8391
@media (max-width: 700px) {
8492
legend {
@@ -90,3 +98,5 @@ fieldset p.submit-buttons {
9098
margin-top: .5em;
9199
}
92100
}
101+
102+
/* < RESPONSIVE */

lukewcs/togglectrl/adm/style/acp_togglectrl_settings.js

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,40 @@
1111
*/
1212

1313
(function ($) {
14+
'use strict';
1415

15-
'use strict';
16-
17-
const constants = Object.freeze({
18-
OpacityEnabled : '1.0',
19-
OpacityDisabled : '0.35',
20-
});
21-
22-
function setState() {
23-
dimOptionGroup('[name="togglectrl_type"]', !$('[name="togglectrl_enabled"]').prop('checked'));
24-
};
16+
const constants = Object.freeze({
17+
OpacityEnabled : '1.0',
18+
OpacityDisabled : '0.35',
19+
});
2520

26-
function dimOptionGroup(selector, dimCondition) {
27-
const c = constants;
21+
function setState() {
22+
dimOptionGroup('[name="togglectrl_type"]', !$('[name="togglectrl_enabled"]').prop('checked'));
23+
};
2824

29-
$(selector).parents('dl').css('opacity', dimCondition ? c.OpacityDisabled : c.OpacityEnabled);
30-
}
25+
function dimOptionGroup(selector, dimCondition) {
26+
const c = constants;
3127

32-
function formReset() {
33-
setTimeout(function() {
34-
setState();
35-
});
36-
};
37-
38-
function disableEnter(e) {
39-
if (e.key == 'Enter' && e.target.type != 'textarea') {
40-
return false;
28+
$(selector).parents('dl').css('opacity', dimCondition ? c.OpacityDisabled : c.OpacityEnabled);
4129
}
42-
};
4330

44-
$(window).ready(function () {
45-
setState();
31+
function formReset() {
32+
setTimeout(function() {
33+
setState();
34+
});
35+
};
36+
37+
function disableEnter(e) {
38+
if (e.key == 'Enter' && e.target.type != 'textarea') {
39+
return false;
40+
}
41+
};
4642

47-
$('#togglectrl_settings') .on('keypress' , disableEnter);
48-
$('#togglectrl_settings') .on('reset' , formReset);
49-
$('[name="togglectrl_enabled"]') .on('change' , setState);
50-
});
43+
$(function () {
44+
setState();
5145

46+
$('#togglectrl_settings') .on('keypress' , disableEnter);
47+
$('#togglectrl_settings') .on('reset' , formReset);
48+
$('[name="togglectrl_enabled"]') .on('change' , setState);
49+
});
5250
})(jQuery);

lukewcs/togglectrl/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"description": "Makes it possible to decide centrally for all extensions which visual style should be used for yes/no switches, provided extensions support Toggle Control.",
55
"homepage": "https://github.com/LukeWCS/toggle-control",
6-
"version": "1.1.1",
7-
"time": "2024-12-15",
6+
"version": "1.2.0",
7+
"time": "2025-10-20",
88
"license": "GPL-2.0-only",
99
"authors": [
1010
{
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=7.4.0,<8.5.0@dev",
17+
"php": ">=8.0.0,<8.5.0@dev",
1818
"composer/installers": "~1.0.0"
1919
},
2020
"extra": {

lukewcs/togglectrl/controller/acp_togglectrl_controller.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,18 @@
1515

1616
class acp_togglectrl_controller
1717
{
18-
protected object $language;
19-
protected object $template;
20-
protected object $request;
21-
protected object $config;
22-
protected object $ext_manager;
23-
2418
protected array $metadata;
2519
public string $u_action;
2620

2721
public function __construct(
28-
\phpbb\language\language $language,
29-
\phpbb\template\template $template,
30-
\phpbb\request\request $request,
31-
\phpbb\config\config $config,
32-
\phpbb\extension\manager $ext_manager
22+
protected \phpbb\language\language $language,
23+
protected \phpbb\template\template $template,
24+
protected \phpbb\request\request $request,
25+
protected \phpbb\config\config $config,
26+
protected \phpbb\extension\manager $ext_manager,
3327
)
3428
{
35-
$this->language = $language;
36-
$this->template = $template;
37-
$this->request = $request;
38-
$this->config = $config;
39-
$this->ext_manager = $ext_manager;
40-
41-
$this->metadata = $this->ext_manager->create_extension_metadata_manager('lukewcs/togglectrl')->get_metadata('all');
29+
$this->metadata = $this->ext_manager->create_extension_metadata_manager('lukewcs/togglectrl')->get_metadata('all');
4230
}
4331

4432
public function module_settings(): void
@@ -133,6 +121,7 @@ private function set_meta_template_vars(string $tpl_prefix, string $copyright):
133121
private function get_lang_ver(string $lang_ext_ver): string
134122
{
135123
preg_match('/^([0-9]+\.[0-9]+\.[0-9]+.*)/', $this->language->lang($lang_ext_ver), $matches);
124+
136125
return ($matches[1] ?? '0.0.0');
137126
}
138127

lukewcs/togglectrl/event/listener.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@
1717

1818
class listener implements EventSubscriberInterface
1919
{
20-
protected object $config;
21-
protected object $template;
22-
2320
public function __construct(
24-
\phpbb\config\config $config,
25-
\phpbb\template\template $template
21+
protected \phpbb\config\config $config,
22+
protected \phpbb\template\template $template,
2623
)
2724
{
28-
$this->config = $config;
29-
$this->template = $template;
3025
}
3126

3227
public static function getSubscribedEvents(): array
@@ -42,7 +37,7 @@ public function generate_template_vars(): void
4237
{
4338
if ($this->config['togglectrl_enabled'])
4439
{
45-
$this->template->assign_var('TOGGLECTRL_TYPE', $this->config['togglectrl_type']);
40+
$this->template->assign_var('TOGGLECTRL_TYPE', (string) $this->config['togglectrl_type']);
4641
}
4742
}
4843
}

lukewcs/togglectrl/ext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ext extends \phpbb\extension\base
1818
public function is_enableable()
1919
{
2020
$valid_phpbb = phpbb_version_compare(PHPBB_VERSION, '3.3.0', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.4.0-dev', '<');
21-
$valid_php = phpbb_version_compare(PHP_VERSION, '7.4.0', '>=') && phpbb_version_compare(PHP_VERSION, '8.5.0-dev', '<');
21+
$valid_php = phpbb_version_compare(PHP_VERSION, '8.0.0', '>=') && phpbb_version_compare(PHP_VERSION, '8.5.0-dev', '<');
2222

2323
return $valid_phpbb && $valid_php;
2424
}

toggle-control_build_changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### 1.2.0
2+
* Release (2025-10-20)
3+
* Auf Construktor Property Promotion umgestellt.
4+
* CSS:
5+
* Auf Nested CSS umgestellt.
6+
* Auf Kirk-Toggles 2.0 aktualisiert.
7+
* PHP Voraussetzung:
8+
* Min. 7.4.0 -> 8.0.0.
9+
* JS überarbeitet.
10+
111
### 1.1.1
212
* Release (2024-12-15)
313
* PHP:

toggle-control_changelog_de.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
### 1.2.0
2+
(2025-10-20)
3+
4+
* Die Voraussetzungen haben sich geändert:
5+
* PHP: 8.0.0 - 8.4.x (Bisher: 7.1.3 - 8.3.x)
6+
* PHP auf Construktor Property Promotion umgestellt. Weitere Infos dazu: [PHP 8 - Constructor Property Promotion](https://www.phpbb.de/community/viewtopic.php?t=247783)
7+
* CSS:
8+
* Auf Nested CSS umgestellt. Weitere Infos dazu: [Nested CSS (verschachteltes CSS)](https://www.phpbb.de/community/viewtopic.php?t=247620)
9+
* Auf Kirk-Toggles 2.0 aktualisiert.
10+
* Javascript überarbeitet.
11+
112
### 1.1.1
213
(2024-12-15)
314

0 commit comments

Comments
 (0)