Skip to content

Commit f8d36db

Browse files
committed
Merge branch 'master' into dev/4.0
2 parents 056b06e + cac4d15 commit f8d36db

File tree

24 files changed

+203
-141
lines changed

24 files changed

+203
-141
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"require": {
2222
"php": ">=8.1",
2323
"composer/installers": "~1.0"
24+
"ext-zip": "*"
2425
},
2526
"require-dev": {
2627
"phing/phing": "~2.4"

helper/packager.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use phpbb\config\config;
1717
use phpbb\di\service_collection;
1818
use phpbb\filesystem\filesystem;
19+
use phpbb\path_helper;
1920
use phpbb\skeleton\ext;
2021
use phpbb\skeleton\template\twig\extension\skeleton_version_compare;
2122
use phpbb\template\context;
@@ -115,17 +116,14 @@ public function create_extension($data)
115116
$filesystem->remove($this->root_path . 'store/tmp-ext');
116117
$filesystem->mkdir($ext_path);
117118

118-
$phpbb31 = (bool) preg_match('/^[\D]*3\.1.*$/', $data['requirements']['phpbb_version_min']);
119-
120119
$template = $this->get_template_engine();
121120
$template->set_custom_style('skeletonextension', $this->root_path . 'ext/phpbb/skeleton/skeleton');
122121
$template->assign_vars([
123122
'COMPONENT' => $data['components'],
124123
'EXTENSION' => $data['extension'],
125124
'REQUIREMENTS' => $data['requirements'],
126125
'AUTHORS' => $data['authors'],
127-
'LANGUAGE' => $this->get_language_version_data($phpbb31),
128-
'S_PHPBB_31' => $phpbb31,
126+
'LANGUAGE' => $this->get_language_version_data($data),
129127
]);
130128

131129
$component_data = $this->get_component_dialog_values();
@@ -201,11 +199,14 @@ protected function get_template_engine()
201199
'assets_version' => null,
202200
]);
203201

202+
/** @var path_helper $path_helper */
204203
$path_helper = $this->phpbb_container->get('path_helper');
204+
/** @var filesystem $filesystem */
205+
$filesystem = $this->phpbb_container->get('filesystem');
205206
$environment = new environment(
206207
$this->phpbb_container->get('assets.bag'),
207208
$config,
208-
$this->phpbb_container->get('filesystem'),
209+
$filesystem,
209210
$path_helper,
210211
$this->phpbb_container->getParameter('core.cache_dir'),
211212
$this->phpbb_container->get('ext.manager'),
@@ -235,19 +236,25 @@ protected function get_template_engine()
235236
* Get an array of language class and methods depending on 3.1 or 3.2
236237
* compatibility, for use in the skeleton twig templates.
237238
*
238-
* @param bool $phpbb31 Is phpBB 3.1 support requested?
239+
* @param array $data Extension data
239240
*
240241
* @return array An array of language data
241242
*/
242-
protected function get_language_version_data($phpbb31)
243+
protected function get_language_version_data($data)
243244
{
245+
$phpbb_31 = false;
246+
if (isset($data['requirements']['phpbb_version_min']))
247+
{
248+
$phpbb_31 = (bool) preg_match('/^\D*3\.1.*$/', $data['requirements']['phpbb_version_min']);
249+
}
250+
244251
return [
245-
'class' => $phpbb31 ? '\phpbb\user' : '\phpbb\language\language',
246-
'object' => $phpbb31 ? 'user' : 'language',
247-
'function' => $phpbb31 ? 'add_lang_ext' : 'add_lang',
252+
'class' => $phpbb_31 ? '\phpbb\user' : '\phpbb\language\language',
253+
'object' => $phpbb_31 ? 'user' : 'language',
254+
'function' => $phpbb_31 ? 'add_lang_ext' : 'add_lang',
248255
'indent' => [
249-
'class' => $phpbb31 ? "\t\t\t" : '',
250-
'object' => $phpbb31 ? "\t" : '',
256+
'class' => $phpbb_31 ? "\t\t\t" : '',
257+
'object' => $phpbb_31 ? "\t" : '',
251258
],
252259
];
253260
}

language/en/common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_EXPLAIN' => 'Creates a GitHub Actions workflow that uses a reusable, phpBB-maintained framework to run PHPUnit tests on your repository. The workflow file is saved in .github/workflows and runs automatically on each commit and pull request.',
131131
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM' => 'Create a standalone GitHub Actions workflow [Deprecated: not recommended unless you plan to modify jobs or steps]',
132132
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_UI' => 'GitHub Actions Workflow (Standalone – Deprecated)',
133-
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_EXPLAIN' => 'Deprecated: Creates a fully standalone workflow to run PHPUnit tests without using the shared phpBB framework. This overrides the reusable workflow and is no longer recommended. The file is saved in .github/workflows and runs on each commit and pull request.',
133+
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_EXPLAIN' => 'Deprecated: Creates a standalone workflow for PHPUnit tests without the shared phpBB framework. Will be overridden if the reusable workflow is also selected. Saved in .github/workflows and runs on each commit and pull request.',
134134
'SKELETON_QUESTION_COMPONENT_BUILD' => 'Create a sample build script for phing',
135135
'SKELETON_QUESTION_COMPONENT_BUILD_UI' => 'Build script (phing)',
136136
'SKELETON_QUESTION_COMPONENT_BUILD_EXPLAIN' => 'A phing build script is generated for your extension which can be used to generate build packages to help simplify the release or deployment processes.',

skeleton/.github/workflows/tests.yml.twig

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
name: Tests
22

3-
{% if COMPONENT.githubactions_custom %}
3+
{% if COMPONENT.githubactions %}
4+
# For most extensions, this workflow should not need changing;
5+
# simply commit it to your repository.
6+
#
7+
# See the README for full details and configuration instructions:
8+
# - https://github.com/phpbb-extensions/test-framework
9+
#
10+
on:
11+
push:
12+
# Run tests when commits are pushed to these branches in your repo,
13+
# or remove this branches section to run tests on all your branches
14+
branches:
15+
- main # Main production branch
16+
- master # Legacy or alternative main branch
17+
- dev/* # Any feature branches under "dev/", e.g., dev/new-feature
18+
- release-* # Any release branches under "release-", e.g., release-1.0.0
19+
20+
pull_request:
21+
# Run tests when pull requests are made on these branches in your repo,
22+
# or remove this branches section to run tests on all your branches
23+
branches:
24+
- main
25+
- master
26+
- dev/*
27+
28+
jobs:
29+
call-tests:
30+
name: Extension tests
31+
# Set the phpBB branch to test your extension with after the @ symbol
32+
# - 3.3.x: Targets the phpBB 3.3.x release line
33+
# - master: Targets the latest development version of phpBB (master branch)
34+
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@{{ skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "4.0", "<") ? '3.3.x' : 'master' }}
35+
with:
36+
# Your extension vendor/package name
37+
EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}
38+
{% elseif COMPONENT.githubactions_custom %}
439
env:
540
EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} # Your extension vendor/package name
641
SNIFF: 1 # Run code sniffer on your code? 1 or 0
@@ -425,39 +460,4 @@ jobs:
425460
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
426461
working-directory: ./phpBB3
427462
# END Other Tests Job
428-
{% else %}
429-
# For most extensions, this workflow should not need changing;
430-
# simply commit it to your repository.
431-
#
432-
# See the README for full details and configuration instructions:
433-
# - https://github.com/phpbb-extensions/test-framework
434-
#
435-
on:
436-
push:
437-
# Run tests when commits are pushed to these branches in your repo,
438-
# or remove this branches section to run tests on all your branches
439-
branches:
440-
- main # Main production branch
441-
- master # Legacy or alternative main branch
442-
- dev/* # Any feature branches under "dev/", e.g., dev/new-feature
443-
- release-* # Any release branches under "release-", e.g., release-1.0.0
444-
445-
pull_request:
446-
# Run tests when pull requests are made on these branches in your repo,
447-
# or remove this branches section to run tests on all your branches
448-
branches:
449-
- main
450-
- master
451-
- dev/*
452-
453-
jobs:
454-
call-tests:
455-
name: Extension tests
456-
# Set the phpBB branch to test your extension with after the @ symbol
457-
# - 3.3.x: Targets the phpBB 3.3.x release line
458-
# - master: Targets the latest development version of phpBB (master branch)
459-
uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@{{ skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "4.0", "<") ? '3.3.x' : 'master' }}
460-
with:
461-
# Your extension vendor/package name
462-
EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}
463463
{% endif %}

skeleton/README.md.twig

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
# {{ EXTENSION.extension_display_name }}
22

3-
## Installation
4-
5-
Copy the extension to phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}
6-
7-
Go to "ACP" > "Customise" > "Extensions" and enable the "{{ EXTENSION.extension_display_name }}" extension.
8-
9-
{% if COMPONENT.tests %}
10-
## Tests and Continuous Integration
3+
This is a basic skeleton to help you start building a phpBB extension. Customise it as needed.
114

12-
{% if COMPONENT.githubactions %}We use GitHub Actions as a continuous integration server and phpunit for our unit testing..{% endif %}
13-
To run the tests locally, you need to install phpBB from its Git repository. Afterward run the following command from the phpBB Git repository's root:
14-
15-
Windows:
16-
17-
phpBB\vendor\bin\phpunit.bat -c phpBB\ext\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\phpunit.xml.dist
18-
19-
others:
5+
## Installation
206

21-
phpBB/vendor/bin/phpunit -c phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}/phpunit.xml.dist
7+
1. Copy the extension to: `phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}`
8+
2. In the ACP, go to: **Customise → Manage extensions**
9+
3. Enable the **{{ EXTENSION.extension_display_name }}** extension
2210

11+
## Extension Development Guide
2312

24-
See more information on the [phpBB Developer Docs](https://area51.phpbb.com/docs/dev/master/testing/index.html)
13+
New to phpBB extension development?
14+
Start here: [phpBB Extension Development Guide](https://area51.phpbb.com/docs/dev/3.3.x/extensions/index.html)
2515

26-
{% endif %}
2716
## License
2817

29-
[GNU General Public License v2](license.txt)
18+
Licensed under the [GNU General Public License v2](license.txt)

skeleton/adm/style/acp_demo_body.html.twig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@
1515
<legend>{{ '{{' }} lang('SETTINGS') }}</legend>
1616
<dl>
1717
<dt><label for="{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye">{{ '{{' }} lang('ACP_{{ EXTENSION.extension_name|upper }}_GOODBYE') ~ lang('COLON') }}</label></dt>
18-
<dd><label><input type="radio" class="radio" name="{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye" value="1"{{ '{' }}% if {{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}_GOODBYE %} checked="checked"{{ '{' }}% endif %} /> {{ '{{' }} lang('YES') }}</label>
19-
<label><input type="radio" class="radio" name="{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye" value="0"{{ '{' }}% if not {{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}_GOODBYE %} checked="checked"{{ '{' }}% endif %} /> {{ '{{' }} lang('NO') }}</label></dd>
18+
<dd>
19+
<label><input type="radio" class="radio" name="{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye" value="1"{{ '{' }}% if {{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}_GOODBYE %} checked="checked"{{ '{' }}% endif %}> {{ '{{' }} lang('YES') }}</label>
20+
<label><input type="radio" class="radio" name="{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye" value="0"{{ '{' }}% if not {{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}_GOODBYE %} checked="checked"{{ '{' }}% endif %}> {{ '{{' }} lang('NO') }}</label>
21+
</dd>
2022
</dl>
2123
</fieldset>
2224

2325
<fieldset class="submit-buttons">
24-
<input class="button1" type="submit" id="submit" name="submit" value="{{ '{{' }} lang('SUBMIT') }}" />&nbsp;
25-
<input class="button2" type="submit" id="preview" name="preview" value="{{ '{{' }} lang('PREVIEW') }}" />
26+
<input class="button1" type="submit" id="submit" name="submit" value="{{ '{{' }} lang('SUBMIT') }}">&nbsp;
27+
<input class="button2" type="submit" id="preview" name="preview" value="{{ '{{' }} lang('PREVIEW') }}">
2628
{{ '{{' }} S_FORM_TOKEN }}
2729
</fieldset>
2830

skeleton/controller/acp_controller.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class acp_controller
111111
// Set output variables for display in the template
112112
$this->template->assign_vars([
113113
'S_ERROR' => $s_errors,
114-
'ERROR_MSG' => $s_errors ? implode('<br />', $errors) : '',
114+
'ERROR_MSG' => $s_errors ? implode('<br>', $errors) : '',
115115
116116
'U_ACTION' => $this->u_action,
117117

skeleton/controller/mcp_controller.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class mcp_controller
7575
// Set output variables for display in the template
7676
$this->template->assign_vars([
7777
'S_ERROR' => $s_errors,
78-
'ERROR_MSG' => $s_errors ? implode('<br />', $errors) : '',
78+
'ERROR_MSG' => $s_errors ? implode('<br>', $errors) : '',
7979
8080
'U_MCP_ACTION' => $this->u_action,
8181
]);

skeleton/controller/ucp_controller.php.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class ucp_controller
9696
// Option settings have been updated
9797
// Confirm this to the user and provide (automated) link back to previous page
9898
meta_refresh(3, $this->u_action);
99-
$message = $this->{{ LANGUAGE.object }}->lang('UCP_{{ EXTENSION.extension_name|upper }}_SAVED') . '<br /><br />' . $this->{{ LANGUAGE.object }}->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>');
99+
$message = $this->{{ LANGUAGE.object }}->lang('UCP_{{ EXTENSION.extension_name|upper }}_SAVED') . '<br><br>' . $this->{{ LANGUAGE.object }}->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>');
100100
trigger_error($message);
101101
}
102102
}
@@ -106,7 +106,7 @@ class ucp_controller
106106
// Set output variables for display in the template
107107
$this->template->assign_vars([
108108
'S_ERROR' => $s_errors,
109-
'ERROR_MSG' => $s_errors ? implode('<br />', $errors) : '',
109+
'ERROR_MSG' => $s_errors ? implode('<br>', $errors) : '',
110110
111111
'U_UCP_ACTION' => $this->u_action,
112112

skeleton/event/main_listener.php.twig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
2020
*/
2121
class main_listener implements EventSubscriberInterface
2222
{
23+
/**
24+
* Map phpBB core events to the listener methods that should handle those events
25+
*
26+
* @return array
27+
*/
2328
public static function getSubscribedEvents()
2429
{
2530
return [
@@ -34,7 +39,7 @@ class main_listener implements EventSubscriberInterface
3439
'core.display_forums_modify_template_vars' => 'display_forums_modify_template_vars',
3540
{% endif %}
3641
{% if COMPONENT.permissions %}
37-
'core.permissions' => 'add_permissions',
42+
'core.permissions' => 'add_permissions',
3843
{% endif %}
3944
];
4045
}

0 commit comments

Comments
 (0)