diff --git a/composer.json b/composer.json
index 5828f68..2ffd82d 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,8 @@
],
"require": {
"php": ">=5.6",
- "composer/installers": "~1.0"
+ "composer/installers": "~1.0",
+ "ext-zip": "*"
},
"require-dev": {
"phing/phing": "~2.4"
diff --git a/helper/packager.php b/helper/packager.php
index dd6df41..aa29339 100644
--- a/helper/packager.php
+++ b/helper/packager.php
@@ -16,6 +16,7 @@
use phpbb\config\config;
use phpbb\di\service_collection;
use phpbb\filesystem\filesystem;
+use phpbb\path_helper;
use phpbb\skeleton\ext;
use phpbb\skeleton\template\twig\extension\skeleton_version_compare;
use phpbb\template\context;
@@ -115,8 +116,6 @@ public function create_extension($data)
$filesystem->remove($this->root_path . 'store/tmp-ext');
$filesystem->mkdir($ext_path);
- $phpbb31 = (bool) preg_match('/^[\D]*3\.1.*$/', $data['requirements']['phpbb_version_min']);
-
$template = $this->get_template_engine();
$template->set_custom_style('skeletonextension', $this->root_path . 'ext/phpbb/skeleton/skeleton');
$template->assign_vars([
@@ -124,8 +123,7 @@ public function create_extension($data)
'EXTENSION' => $data['extension'],
'REQUIREMENTS' => $data['requirements'],
'AUTHORS' => $data['authors'],
- 'LANGUAGE' => $this->get_language_version_data($phpbb31),
- 'S_PHPBB_31' => $phpbb31,
+ 'LANGUAGE' => $this->get_language_version_data($data),
]);
$component_data = $this->get_component_dialog_values();
@@ -201,10 +199,13 @@ protected function get_template_engine()
'assets_version' => null,
]);
+ /** @var path_helper $path_helper */
$path_helper = $this->phpbb_container->get('path_helper');
+ /** @var filesystem $filesystem */
+ $filesystem = $this->phpbb_container->get('filesystem');
$environment = new environment(
$config,
- $this->phpbb_container->get('filesystem'),
+ $filesystem,
$path_helper,
$this->phpbb_container->getParameter('core.cache_dir'),
$this->phpbb_container->get('ext.manager'),
@@ -236,19 +237,25 @@ protected function get_template_engine()
* Get an array of language class and methods depending on 3.1 or 3.2
* compatibility, for use in the skeleton twig templates.
*
- * @param bool $phpbb31 Is phpBB 3.1 support requested?
+ * @param array $data Extension data
*
* @return array An array of language data
*/
- protected function get_language_version_data($phpbb31)
+ protected function get_language_version_data($data)
{
+ $phpbb_31 = false;
+ if (isset($data['requirements']['phpbb_version_min']))
+ {
+ $phpbb_31 = (bool) preg_match('/^\D*3\.1.*$/', $data['requirements']['phpbb_version_min']);
+ }
+
return [
- 'class' => $phpbb31 ? '\phpbb\user' : '\phpbb\language\language',
- 'object' => $phpbb31 ? 'user' : 'language',
- 'function' => $phpbb31 ? 'add_lang_ext' : 'add_lang',
+ 'class' => $phpbb_31 ? '\phpbb\user' : '\phpbb\language\language',
+ 'object' => $phpbb_31 ? 'user' : 'language',
+ 'function' => $phpbb_31 ? 'add_lang_ext' : 'add_lang',
'indent' => [
- 'class' => $phpbb31 ? "\t\t\t" : '',
- 'object' => $phpbb31 ? "\t" : '',
+ 'class' => $phpbb_31 ? "\t\t\t" : '',
+ 'object' => $phpbb_31 ? "\t" : '',
],
];
}
diff --git a/language/en/common.php b/language/en/common.php
index 5d914a3..0f085d8 100644
--- a/language/en/common.php
+++ b/language/en/common.php
@@ -130,7 +130,7 @@
'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.',
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM' => 'Create a standalone GitHub Actions workflow [Deprecated: not recommended unless you plan to modify jobs or steps]',
'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_UI' => 'GitHub Actions Workflow (Standalone – Deprecated)',
- '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.',
+ '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.',
'SKELETON_QUESTION_COMPONENT_BUILD' => 'Create a sample build script for phing',
'SKELETON_QUESTION_COMPONENT_BUILD_UI' => 'Build script (phing)',
'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.',
diff --git a/skeleton/.github/workflows/tests.yml.twig b/skeleton/.github/workflows/tests.yml.twig
index e984322..552fb5a 100644
--- a/skeleton/.github/workflows/tests.yml.twig
+++ b/skeleton/.github/workflows/tests.yml.twig
@@ -1,6 +1,41 @@
name: Tests
-{% if COMPONENT.githubactions_custom %}
+{% if COMPONENT.githubactions %}
+# For most extensions, this workflow should not need changing;
+# simply commit it to your repository.
+#
+# See the README for full details and configuration instructions:
+# - https://github.com/phpbb-extensions/test-framework
+#
+on:
+ push:
+ # Run tests when commits are pushed to these branches in your repo,
+ # or remove this branches section to run tests on all your branches
+ branches:
+ - main # Main production branch
+ - master # Legacy or alternative main branch
+ - dev/* # Any feature branches under "dev/", e.g., dev/new-feature
+ - release-* # Any release branches under "release-", e.g., release-1.0.0
+
+ pull_request:
+ # Run tests when pull requests are made on these branches in your repo,
+ # or remove this branches section to run tests on all your branches
+ branches:
+ - main
+ - master
+ - dev/*
+
+jobs:
+ call-tests:
+ name: Extension tests
+ # Set the phpBB branch to test your extension with after the @ symbol
+ # - 3.3.x: Targets the phpBB 3.3.x release line
+ # - master: Targets the latest development version of phpBB (master branch)
+ uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@{{ skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "4.0", "<") ? '3.3.x' : 'master' }}
+ with:
+ # Your extension vendor/package name
+ EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}
+{% elseif COMPONENT.githubactions_custom %}
env:
EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} # Your extension vendor/package name
SNIFF: 1 # Run code sniffer on your code? 1 or 0
@@ -425,39 +460,4 @@ jobs:
run: phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/.github/phpunit-$DB-github.xml --bootstrap ./tests/bootstrap.php
working-directory: ./phpBB3
# END Other Tests Job
-{% else %}
-# For most extensions, this workflow should not need changing;
-# simply commit it to your repository.
-#
-# See the README for full details and configuration instructions:
-# - https://github.com/phpbb-extensions/test-framework
-#
-on:
- push:
- # Run tests when commits are pushed to these branches in your repo,
- # or remove this branches section to run tests on all your branches
- branches:
- - main # Main production branch
- - master # Legacy or alternative main branch
- - dev/* # Any feature branches under "dev/", e.g., dev/new-feature
- - release-* # Any release branches under "release-", e.g., release-1.0.0
-
- pull_request:
- # Run tests when pull requests are made on these branches in your repo,
- # or remove this branches section to run tests on all your branches
- branches:
- - main
- - master
- - dev/*
-
-jobs:
- call-tests:
- name: Extension tests
- # Set the phpBB branch to test your extension with after the @ symbol
- # - 3.3.x: Targets the phpBB 3.3.x release line
- # - master: Targets the latest development version of phpBB (master branch)
- uses: phpbb-extensions/test-framework/.github/workflows/tests.yml@{{ skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "4.0", "<") ? '3.3.x' : 'master' }}
- with:
- # Your extension vendor/package name
- EXTNAME: {{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}
{% endif %}
diff --git a/skeleton/README.md.twig b/skeleton/README.md.twig
index e14d56c..1f72722 100644
--- a/skeleton/README.md.twig
+++ b/skeleton/README.md.twig
@@ -1,29 +1,18 @@
# {{ EXTENSION.extension_display_name }}
-## Installation
-
-Copy the extension to phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}
-
-Go to "ACP" > "Customise" > "Extensions" and enable the "{{ EXTENSION.extension_display_name }}" extension.
-
-{% if COMPONENT.tests %}
-## Tests and Continuous Integration
+This is a basic skeleton to help you start building a phpBB extension. Customise it as needed.
-{% if COMPONENT.githubactions %}We use GitHub Actions as a continuous integration server and phpunit for our unit testing..{% endif %}
-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:
-
-Windows:
-
- phpBB\vendor\bin\phpunit.bat -c phpBB\ext\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\phpunit.xml.dist
-
-others:
+## Installation
- phpBB/vendor/bin/phpunit -c phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}/phpunit.xml.dist
+1. Copy the extension to: `phpBB/ext/{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}`
+2. In the ACP, go to: **Customise → Manage extensions**
+3. Enable the **{{ EXTENSION.extension_display_name }}** extension
+## Extension Development Guide
-See more information on the [phpBB Developer Docs](https://area51.phpbb.com/docs/dev/master/testing/index.html)
+New to phpBB extension development?
+Start here: [phpBB Extension Development Guide](https://area51.phpbb.com/docs/dev/3.3.x/extensions/index.html)
-{% endif %}
## License
-[GNU General Public License v2](license.txt)
+Licensed under the [GNU General Public License v2](license.txt)
diff --git a/skeleton/adm/style/acp_demo_body.html.twig b/skeleton/adm/style/acp_demo_body.html.twig
index d3c853b..65af8bc 100644
--- a/skeleton/adm/style/acp_demo_body.html.twig
+++ b/skeleton/adm/style/acp_demo_body.html.twig
@@ -15,14 +15,16 @@
-
-
+
+
+
+
diff --git a/skeleton/controller/acp_controller.php.twig b/skeleton/controller/acp_controller.php.twig
index 2705fc0..a66d66b 100644
--- a/skeleton/controller/acp_controller.php.twig
+++ b/skeleton/controller/acp_controller.php.twig
@@ -111,7 +111,7 @@ class acp_controller
// Set output variables for display in the template
$this->template->assign_vars([
'S_ERROR' => $s_errors,
- 'ERROR_MSG' => $s_errors ? implode(' ', $errors) : '',
+ 'ERROR_MSG' => $s_errors ? implode(' ', $errors) : '',
'U_ACTION' => $this->u_action,
diff --git a/skeleton/controller/mcp_controller.php.twig b/skeleton/controller/mcp_controller.php.twig
index e5279b4..a7e51c4 100644
--- a/skeleton/controller/mcp_controller.php.twig
+++ b/skeleton/controller/mcp_controller.php.twig
@@ -75,7 +75,7 @@ class mcp_controller
// Set output variables for display in the template
$this->template->assign_vars([
'S_ERROR' => $s_errors,
- 'ERROR_MSG' => $s_errors ? implode(' ', $errors) : '',
+ 'ERROR_MSG' => $s_errors ? implode(' ', $errors) : '',
'U_MCP_ACTION' => $this->u_action,
]);
diff --git a/skeleton/controller/ucp_controller.php.twig b/skeleton/controller/ucp_controller.php.twig
index 5109e53..cac520b 100644
--- a/skeleton/controller/ucp_controller.php.twig
+++ b/skeleton/controller/ucp_controller.php.twig
@@ -96,7 +96,7 @@ class ucp_controller
// Option settings have been updated
// Confirm this to the user and provide (automated) link back to previous page
meta_refresh(3, $this->u_action);
- $message = $this->{{ LANGUAGE.object }}->lang('UCP_{{ EXTENSION.extension_name|upper }}_SAVED') . '