├── CHANGELOG.md
├── README.md
├── composer.json
├── config
├── console.yml
├── routing.yml
├── services.yml
└── skeletons.yml
├── console
└── create.php
├── controller
└── main.php
├── event
└── main_listener.php
├── ext.php
├── helper
├── packager.php
└── validator.php
├── language
└── en
│ └── common.php
├── license.txt
├── package-lock.json
├── package.json
├── skeleton.php
├── skeleton
├── .github
│ └── workflows
│ │ └── tests.yml.twig
├── README.md.twig
├── acp
│ ├── main_info.php.twig
│ └── main_module.php.twig
├── adm
│ └── style
│ │ └── acp_demo_body.html.twig
├── build.xml.twig
├── composer.json.twig
├── config
│ ├── parameters.yml.twig
│ ├── routing.yml.twig
│ └── services.yml.twig
├── console
│ └── command
│ │ └── sample.php.twig
├── controller
│ ├── acp_controller.php.twig
│ ├── main_controller.php.twig
│ ├── mcp_controller.php.twig
│ └── ucp_controller.php.twig
├── cron
│ └── task
│ │ └── sample.php.twig
├── event
│ └── main_listener.php.twig
├── ext.php.twig
├── language
│ └── en
│ │ ├── cli.php.twig
│ │ ├── common.php.twig
│ │ ├── info_acp_demo.php.twig
│ │ ├── info_mcp_demo.php.twig
│ │ ├── info_ucp_demo.php.twig
│ │ └── permissions_demo.php.twig
├── license.txt.twig
├── mcp
│ ├── main_info.php.twig
│ └── main_module.php.twig
├── migrations
│ ├── install_acp_module.php.twig
│ ├── install_cron.php.twig
│ ├── install_mcp_module.php.twig
│ ├── install_sample_data.php.twig
│ ├── install_sample_schema.php.twig
│ └── install_ucp_module.php.twig
├── notification
│ └── type
│ │ └── sample.php.twig
├── phpunit.xml.dist.twig
├── service.php.twig
├── styles
│ └── prosilver
│ │ └── template
│ │ ├── demo_body.html.twig
│ │ ├── event
│ │ └── overall_header_navigation_prepend.html.twig
│ │ ├── mcp_demo_body.html.twig
│ │ └── ucp_demo_body.html.twig
├── tests
│ ├── controller
│ │ └── main_test.php.twig
│ ├── dbal
│ │ ├── fixtures
│ │ │ └── config.xml.twig
│ │ └── simple_test.php.twig
│ └── functional
│ │ └── view_test.php.twig
└── ucp
│ ├── main_info.php.twig
│ └── main_module.php.twig
├── styles
└── prosilver
│ ├── template
│ ├── editor.js
│ ├── event
│ │ └── overall_header_navigation_prepend.html
│ └── skeleton_body.html
│ └── theme
│ ├── skeleton.css
│ ├── skeleton.css.map
│ └── skeleton.scss
└── template
└── twig
└── extension
└── skeleton_version_compare.php
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## 1.2.0 - 2025-06-04
4 |
5 | - Dropped support for phpBB 3.2.x. This version now requires at least phpBB 3.3.0 and PHP 7.1.
6 | - Enhanced the generated skeleton README with links to extension development documentation.
7 | - Removed remaining XHTML artifacts from the generated skeleton files.
8 | - Updated generated PHPUnit test files to follow more consistent and modern PHPUnit practices.
9 | - Set the reusable GitHub Actions workflow as the default, replacing the older standalone workflow (now deprecated).
10 | - Updated version constraints to prevent installation on phpBB4, while ensuring it doesn’t cause errors if run within phpBB4.
11 | - Performed various behind-the-scenes code optimizations.
12 |
13 | ## 1.1.16 - 2025-05-23
14 |
15 | - Deprecating the older standalone GitHub Actions workflow in favor of the newer, simpler, re-usable workflow maintained by phpBB.
16 | - Improved the documentation in the new re-usable GitHub Actions workflow.
17 | - Improved the CLI experience when choosing which GitHub Actions workflow to generate.
18 |
19 | ## 1.1.15 - 2025-04-30
20 |
21 | - Added a header section to the Skeleton with key links to its documentation, phpBB’s coding guidelines, and extension policies.
22 | - Added direct documentation links to each section of the Skeleton’s interface for quicker access.
23 | - Updated GitHub Actions to generate a tests.yml using phpBB’s reusable GitHub Actions workflow by default, while still supporting the original standalone tests.yml for custom setups.
24 | - Removed Travis CI, as it is no longer supported by phpBB and no longer free for open source projects.
25 | - Decoupled GitHub Actions workflow generation from PHPUnit test generation—each can now be created independently.
26 |
27 | ## 1.1.14 - 2025-04-20
28 |
29 | - Updated GitHub action workflows to address compatibility and bug issues.
30 |
31 | ## 1.1.13 - 2025-01-19
32 |
33 | - Fixed an issue where test suite files failed to be located and created.
34 | - Minor code improvements and cleanup.
35 |
36 | ## 1.1.12 - 2024-09-29
37 |
38 | - Updated GitHub action workflows to address compatibility and bug issues.
39 | - Added PHP 8.4 testing to GitHub action workflows.
40 | - Ensure Skeleton extension can only be installed on compatible versions of phpBB.
41 | - Minor code improvements and cleanup.
42 |
43 | ## 1.1.11 - 2023-12-29
44 |
45 | - Updated GitHub Actions workflow to include "main" as a default repo branch to test.
46 | - Added support for breadcrumbs when viewing the Skeleton page in a forum.
47 |
48 | ## 1.1.10 - 2023-05-13
49 |
50 | - Updated GitHub Actions workflow files.
51 | - Removed translation of *CP module page titles as it's not necessary.
52 | - Updated the Skeleton icon.
53 | - Minor code improvements and cleanup.
54 |
55 | ## 1.1.9 - 2022-06-17
56 |
57 | - Fixed cron task naming conventions.
58 |
59 | ## 1.1.8 - 2021-08-16
60 |
61 | - Updated minimum requirements: PHP 5.6 and phpBB 3.2.3.
62 | - Fixed unexpected errors for phpBB and PHP version constraints using ">" and "<" characters.
63 | - Internally, some minor code improvements.
64 | - Internally, switched to NPM to manage third party package dependencies.
65 | - Internally, implemented unit and functional test coverage for code reliability.
66 |
67 | ## 1.1.7 - 2021-05-28
68 |
69 | - Added validation on user input for homepage URLs, author email addresses, and version requirement patterns.
70 | - Fixed validation of the extension display name when using the CLI.
71 | - Internally moved the creation of extension composer.json from PHP logic to a TWIG template.
72 | - Updated default phpBB version max requirement to <4.0.0@dev.
73 |
74 | ## 1.1.6 - 2020-12-28
75 |
76 | - Added an option to generate GitHub Actions workflow for Continuous Integration testing.
77 | - Fixed an issue that prevented dot-files and dot-directories from being generated.
78 | - Updated some syntax in the sample PHPUnit test files.
79 |
80 | ## 1.1.5 - 2020-09-11
81 |
82 | - Make sure the config created for cron by migration is dynamic.
83 | - Updated all PHP arrays to use modern shortened syntax.
84 | - Updated Travis config files.
85 | - Updated Read Me files.
86 |
87 | ## 1.1.4 - 2020-02-13
88 |
89 | - Generated permissions now include a Moderator Role.
90 | - Updated the GPL-2.0 license text file to the most current version.
91 | - Updated documentation links to correctly point to the 3.3.x branch.
92 | - Updated to a fancy tooltip when hovering the mouse over the "Components" options in the web-based interface.
93 |
94 | ## 1.1.3 - 2019-11-22
95 |
96 | - Updated to support phpBB 3.3.x.
97 | - Will now enforce lowercase-only vendor and extension names.
98 | - Will now use Twig template namespaces for rendering template files in generated controller files.
99 | - Will now generate Travis-CI tests to run against phpBB 3.3.x (unless you specify an earlier version of phpBB as a maximum version constraint).
100 | - Will attempt to do a better job of creating the correct notification files, based on your phpBB version constraints.
101 | - Removed third party Symfony components previously required in phpBB 3.1 installations, resulting in much faster performance.
102 | - Loads of additional little code inspection fixes.
103 |
104 | ## 1.1.2 - 2019-07-13
105 |
106 | - Updated generated .travis.yml configuration to use the trusty build.
107 |
108 | ## 1.1.1 - 2019-02-27
109 |
110 | - Added a new Permissions component to generate skeleton files that add and use permissions in an extension.
111 | - Improved the handling of special characters in the Display Name. Now &, < and > are displayed correctly, while double-quotes are strictly invalid.
112 | - Improved the generated sample migration file with a lot more documented examples of configs, config_text, permissions, and custom functions.
113 | - Improved the depends_on() values in generated migration files.
114 | - Improved the naming of generated control panel language variables.
115 | - Improved the generation of skeleton files so that only files for the selected components will be built.
116 |
117 | ## 1.1.0 - 2019-01-14
118 |
119 | - Interface updates:
120 | - The Skeleton Extension can no longer be installed on phpBB 3.1 boards. The minimum requirement is now phpBB 3.2.0 or newer. (Note that you can still create skeletons that will support and run on phpBB 3.1 boards).
121 | - The components section of the web UI has been organized into categories to improve the user experience when choosing what the Skeleton will create.
122 | - The web UI user documentation link has been enhanced with a graphic icon to improve its visibility.
123 | - Skeleton updates:
124 | - Skeleton files have dropped the use of "Acme" and "Demo" in favor of your own vendor and extension names.
125 | - Skeleton template files now use TWIG syntax instead of old phpBB 3.0 style template syntax.
126 | - Improved distinctions between skeletons designed to be compatible with phpBB >=3.1 vs. >=3.2. For example, skeletons built to support 3.1 and above will still use the User object for language functions, while skeletons built for 3.2 and above will use the newer Language object for language functions.
127 | - All skeleton files have been overhauled with improved DocBlock and sample code that exemplifies phpBB's coding guidelines and best practices.
128 | - ACP, UCP, and MCP modules have been updated to utilise controller classes.
129 |
130 | ## 1.0.7 - 2018-03-14
131 |
132 | - The generated composer.json will now have the standard "GPL-2.0-only" license identifier.
133 | - The generated .travis.yml has a more up-to-date test configuration for phpBB 3.2.x environment.
134 |
135 | ## 1.0.6 - 2017-09-07
136 |
137 | - Updated generated .travis.yml configuration with fixes for setting up EPV testing.
138 |
139 | ## 1.0.5 - 2017-07-28
140 |
141 | - Updated generated .travis.yml configuration to comply with recent changes to Travis and EPV. The Travis configuration file will also be generated appropriately for 3.1.x or 3.2.x environments based on the extension's minimum phpBB version.
142 |
143 | ## 1.0.4 - 2017-05-04
144 |
145 | - Updated the generated composer.json files to include the composer/installers requirement.
146 | - Updated the generated acp_demo_body.html template to follow a more correct ACP layout configuration.
147 | - Updated the generated acp main_module.php to generate use the correct error flags in trigger_errors.
148 | - Switched skeleton's nav-bar icon to an SVG image for better style and retina display compatibility.
149 |
150 | ## 1.0.3 - 2017-01-12
151 |
152 | - Add support for UTF-8 characters in fields (extension full name, description, author info, etc.).
153 | - Only add information about unit testing to the README when testing components are selected.
154 | - Fixed the extension name used in the generated build script component.
155 | - Fixed undeclared class properties generated in the ACP module component.
156 | - Fixed the missing empty new line at the end of the generated composer.json file.
157 | - Increased the minimum PHP requirement to PHP 5.4 to support proper JSON file generation (such as UTF-8 support).
158 |
159 | ## 1.0.2 - 2016-11-19
160 |
161 | - Re-organized some of the "Extension packaging" fields with clearer names and ordering.
162 | - Shortened the name of the nav-bar link in the web interface to Skeleton Extension.
163 | - Helpful tooltips have been added to each of the checkboxes in the "Components" section of the web interface.
164 | - Added a link to Skeleton Extension's Documentation in the web interface.
165 | - Added warnings when trying to use 'phpbb' or 'core' as vendor and extension names.
166 | - Added view online page sample code to the event listener for the controller component.
167 | - Added a missing migration file to generated UCP components.
168 | - Fixed an issue where the controller component did not generate a correct event listener.
169 | - Fixed an issue where the controller component did not generate a template event listener for the controller's nav-bar link.
170 | - Fixed an issue where the notification component did not generate a valid ext.php (references to the notification services will now have the correct vendor and ext names instead of "dev.dev").
171 | - Use the correct Symfony syntax for non-shared services: `scope: prototype` in phpBB 3.1.x and `shared: false` in phpBB 3.2.
172 |
173 | ## 1.0.1 - 2016-10-13
174 |
175 | - Fixed an issue where in phpBB 3.1 boards, the Command Line Interface would not work.
176 | - Skeleton files now have file DocBlocks uniquely named after the extension (was previously based on phpBB's own docblock). The current date and primary author name are also automatically added to the docblock's @copyright.
177 | - Skeleton ACP PHP files have correct visibility declarations for methods and properties now.
178 | - Skeleton config service files correctly encapsulate all strings in quotes that begin with @ and % per Symfony specifications.
179 | - Skeleton PHP files have all their DocBlocks updated to be consistent with PSR-5 recommendations.
180 | - Skeleton event class methods that do not use the `$event` variable do not have them defined as an argument (this is done to demonstrate that the `$event` argument is only needed if actually used in an event listener method).
181 | - Internal DocBlocks have been updated.
182 |
183 | ## 1.0.0 - 2016-08-04
184 |
185 | - First release
186 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # phpBB Skeleton Extension
2 |
3 | [](https://github.com/phpbb-extensions/phpbb-ext-skeleton/actions)
4 | [](https://codecov.io/gh/phpbb-extensions/phpbb-ext-skeleton)
5 |
6 | phpBB's Skeleton Extension is a tool for extension authors to help speed up and simplify the task of starting a new extension project. It generates sample starter files and directories in a skeleton package that you can use to begin building your extension.
7 |
8 | View the [documentation](https://area51.phpbb.com/docs/dev/3.3.x/extensions/skeleton_extension.html) for installation and usage information.
9 |
10 | The Skeleton Extension is available from phpBB.com as an Official Tool [here](https://www.phpbb.com/customise/db/official_tool/ext_skeleton/).
11 |
12 | ## Contributing
13 |
14 | We welcome contributions to help make this extension even better. Please fork this repository, install it to a local development copy of phpBB, and send us a pull request with your bug fixes or feature improvements.
15 |
16 | ## License
17 |
18 | [GNU General Public License v2](license.txt)
19 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "phpbb/skeleton",
3 | "type": "phpbb-extension",
4 | "description": "The official phpBB skeleton extension generator.",
5 | "homepage": "https://www.phpbb.com/customise/db/official_tool/ext_skeleton/",
6 | "version": "1.2.0",
7 | "license": "GPL-2.0-only",
8 | "authors": [
9 | {
10 | "name": "Joas Schilling",
11 | "email": "nickvergessen@gmx.de",
12 | "homepage": "https://github.com/nickvergessen/",
13 | "role": "Former Lead Developer"
14 | },
15 | {
16 | "name": "Matt Friedman",
17 | "homepage": "https://imattpro.github.io",
18 | "role": "Extensions Development Team Lead"
19 | }
20 | ],
21 | "require": {
22 | "php": ">=7.1",
23 | "composer/installers": "~1.0",
24 | "ext-zip": "*"
25 | },
26 | "require-dev": {
27 | "phing/phing": "~2.4"
28 | },
29 | "extra": {
30 | "display-name": "phpBB Skeleton Extension",
31 | "soft-require": {
32 | "phpbb/phpbb": ">=3.3.0,<4.0.0@dev"
33 | },
34 | "version-check": {
35 | "host": "www.phpbb.com",
36 | "directory": "/customise/db/official_tool/ext_skeleton",
37 | "filename": "version_check",
38 | "ssl": true
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/config/console.yml:
--------------------------------------------------------------------------------
1 | services:
2 | phpbb.skeleton.command.create:
3 | class: phpbb\skeleton\console\create
4 | arguments:
5 | - '@user'
6 | - '@language'
7 | - '@phpbb.skeleton.helper.packager'
8 | - '@phpbb.skeleton.helper.validator'
9 | tags:
10 | - { name: console.command }
11 |
--------------------------------------------------------------------------------
/config/routing.yml:
--------------------------------------------------------------------------------
1 | phpbb_skeleton_controller:
2 | path: /skeleton
3 | defaults: { _controller: phpbb.skeleton.controller:handle }
4 |
--------------------------------------------------------------------------------
/config/services.yml:
--------------------------------------------------------------------------------
1 | imports:
2 | - { resource: console.yml }
3 | - { resource: skeletons.yml }
4 |
5 | services:
6 | phpbb.skeleton.controller:
7 | class: phpbb\skeleton\controller\main
8 | arguments:
9 | - '@config'
10 | - '@controller.helper'
11 | - '@language'
12 | - '@request'
13 | - '@phpbb.skeleton.helper.packager'
14 | - '@phpbb.skeleton.helper.validator'
15 | - '@template'
16 | - '@user'
17 |
18 | phpbb.skeleton.helper.packager:
19 | class: phpbb\skeleton\helper\packager
20 | arguments:
21 | - '@service_container'
22 | - '@phpbb.skeleton.collection'
23 | - '%core.root_path%'
24 |
25 | phpbb.skeleton.helper.validator:
26 | class: phpbb\skeleton\helper\validator
27 | arguments:
28 | - '@language'
29 |
30 | phpbb.skeleton.listener:
31 | class: phpbb\skeleton\event\main_listener
32 | arguments:
33 | - '@controller.helper'
34 | - '@template'
35 | tags:
36 | - { name: event.listener }
37 |
--------------------------------------------------------------------------------
/config/skeletons.yml:
--------------------------------------------------------------------------------
1 | services:
2 | phpbb.skeleton.collection:
3 | class: phpbb\di\service_collection
4 | arguments:
5 | - '@service_container'
6 | tags:
7 | - { name: service_collection, tag: phpbb.skeleton.ext.skeleton }
8 |
9 | phpbb.skeleton.ext.skeleton.phplistener:
10 | class: phpbb\skeleton\skeleton
11 | arguments:
12 | - 'phplistener'
13 | - false
14 | - []
15 | - ['config/services.yml', 'event/main_listener.php', 'language/en/common.php']
16 | - 'BACK_END'
17 | tags:
18 | - { name: phpbb.skeleton.ext.skeleton }
19 |
20 | phpbb.skeleton.ext.skeleton.htmllistener:
21 | class: phpbb\skeleton\skeleton
22 | arguments:
23 | - 'htmllistener'
24 | - false
25 | - []
26 | - ['styles/prosilver/template/event/overall_header_navigation_prepend.html']
27 | - 'FRONT_END'
28 | tags:
29 | - { name: phpbb.skeleton.ext.skeleton }
30 |
31 | phpbb.skeleton.ext.skeleton.acp:
32 | class: phpbb\skeleton\skeleton
33 | arguments:
34 | - 'acp'
35 | - false
36 | - []
37 | - ['acp/main_info.php', 'acp/main_module.php', 'adm/style/acp_demo_body.html', 'config/services.yml', 'controller/acp_controller.php', 'language/en/common.php', 'language/en/info_acp_demo.php', 'migrations/install_acp_module.php']
38 | - 'CONTROL_PANELS'
39 | tags:
40 | - { name: phpbb.skeleton.ext.skeleton }
41 |
42 | phpbb.skeleton.ext.skeleton.mcp:
43 | class: phpbb\skeleton\skeleton
44 | arguments:
45 | - 'mcp'
46 | - false
47 | - []
48 | - ['mcp/main_info.php', 'mcp/main_module.php', 'config/services.yml', 'controller/mcp_controller.php', 'styles/prosilver/template/mcp_demo_body.html', 'language/en/info_mcp_demo.php', 'migrations/install_mcp_module.php']
49 | - 'CONTROL_PANELS'
50 | tags:
51 | - { name: phpbb.skeleton.ext.skeleton }
52 |
53 | phpbb.skeleton.ext.skeleton.ucp:
54 | class: phpbb\skeleton\skeleton
55 | arguments:
56 | - 'ucp'
57 | - false
58 | - []
59 | - ['ucp/main_info.php', 'ucp/main_module.php', 'config/services.yml', 'controller/ucp_controller.php', 'styles/prosilver/template/ucp_demo_body.html', 'language/en/info_ucp_demo.php', 'migrations/install_ucp_module.php', 'migrations/install_sample_schema.php']
60 | - 'CONTROL_PANELS'
61 | tags:
62 | - { name: phpbb.skeleton.ext.skeleton }
63 |
64 | phpbb.skeleton.ext.skeleton.migration:
65 | class: phpbb\skeleton\skeleton
66 | arguments:
67 | - 'migration'
68 | - false
69 | - []
70 | - ['migrations/install_sample_schema.php', 'migrations/install_sample_data.php']
71 | - 'DATABASE'
72 | tags:
73 | - { name: phpbb.skeleton.ext.skeleton }
74 |
75 | phpbb.skeleton.ext.skeleton.service:
76 | class: phpbb\skeleton\skeleton
77 | arguments:
78 | - 'service'
79 | - false
80 | - []
81 | - ['service.php', 'config/services.yml', 'config/parameters.yml']
82 | - 'BACK_END'
83 | tags:
84 | - { name: phpbb.skeleton.ext.skeleton }
85 |
86 | phpbb.skeleton.ext.skeleton.controller:
87 | class: phpbb\skeleton\skeleton
88 | arguments:
89 | - 'controller'
90 | - false
91 | - []
92 | - ['config/routing.yml', 'config/services.yml', 'event/main_listener.php', 'language/en/common.php', 'controller/main_controller.php', 'styles/prosilver/template/demo_body.html', 'styles/prosilver/template/event/overall_header_navigation_prepend.html']
93 | - 'BACK_END'
94 | tags:
95 | - { name: phpbb.skeleton.ext.skeleton }
96 |
97 | phpbb.skeleton.ext.skeleton.ext:
98 | class: phpbb\skeleton\skeleton
99 | arguments:
100 | - 'ext'
101 | - false
102 | - []
103 | - ['ext.php']
104 | - 'BACK_END'
105 | tags:
106 | - { name: phpbb.skeleton.ext.skeleton }
107 |
108 | phpbb.skeleton.ext.skeleton.console:
109 | class: phpbb\skeleton\skeleton
110 | arguments:
111 | - 'console'
112 | - false
113 | - []
114 | - ['config/services.yml', 'console/command/sample.php', 'language/en/cli.php']
115 | - 'OTHER'
116 | tags:
117 | - { name: phpbb.skeleton.ext.skeleton }
118 |
119 | phpbb.skeleton.ext.skeleton.cron:
120 | class: phpbb\skeleton\skeleton
121 | arguments:
122 | - 'cron'
123 | - false
124 | - []
125 | - ['config/services.yml', 'cron/task/sample.php', 'migrations/install_cron.php']
126 | - 'OTHER'
127 | tags:
128 | - { name: phpbb.skeleton.ext.skeleton }
129 |
130 | phpbb.skeleton.ext.skeleton.notification:
131 | class: phpbb\skeleton\skeleton
132 | arguments:
133 | - 'notification'
134 | - false
135 | - []
136 | - ['ext.php', 'config/services.yml', 'notification/type/sample.php', 'language/en/common.php', 'language/en/info_ucp_demo.php']
137 | - 'OTHER'
138 | tags:
139 | - { name: phpbb.skeleton.ext.skeleton }
140 |
141 | phpbb.skeleton.ext.skeleton.permissions:
142 | class: phpbb\skeleton\skeleton
143 | arguments:
144 | - 'permissions'
145 | - false
146 | - []
147 | - ['migrations/install_sample_data.php', 'event/main_listener.php', 'language/en/permissions_demo.php', 'config/services.yml']
148 | - 'OTHER'
149 | tags:
150 | - { name: phpbb.skeleton.ext.skeleton }
151 |
152 | phpbb.skeleton.ext.skeleton.tests:
153 | class: phpbb\skeleton\skeleton
154 | arguments:
155 | - 'tests'
156 | - false
157 | - []
158 | - ['tests/controller/main_test.php', 'tests/dbal/fixtures/config.xml', 'tests/dbal/simple_test.php', 'tests/functional/view_test.php', 'phpunit.xml.dist', '.github/workflows/tests.yml']
159 | - 'TEST_DEPLOY'
160 | tags:
161 | - { name: phpbb.skeleton.ext.skeleton }
162 |
163 | phpbb.skeleton.ext.skeleton.githubactions:
164 | class: phpbb\skeleton\skeleton
165 | arguments:
166 | - 'githubactions'
167 | - false
168 | - []
169 | - ['.github/workflows/tests.yml']
170 | - 'TEST_DEPLOY'
171 | tags:
172 | - { name: phpbb.skeleton.ext.skeleton }
173 |
174 | phpbb.skeleton.ext.skeleton.githubactions_custom:
175 | class: phpbb\skeleton\skeleton
176 | arguments:
177 | - 'githubactions_custom'
178 | - false
179 | - []
180 | - ['.github/workflows/tests.yml']
181 | - 'TEST_DEPLOY'
182 | tags:
183 | - { name: phpbb.skeleton.ext.skeleton }
184 |
185 | phpbb.skeleton.ext.skeleton.build:
186 | class: phpbb\skeleton\skeleton
187 | arguments:
188 | - 'build'
189 | - false
190 | - []
191 | - ['build.xml']
192 | - 'TEST_DEPLOY'
193 | tags:
194 | - { name: phpbb.skeleton.ext.skeleton }
195 |
--------------------------------------------------------------------------------
/console/create.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton\console;
15 |
16 | use phpbb\console\command\command;
17 | use phpbb\language\language;
18 | use phpbb\skeleton\helper\packager;
19 | use phpbb\skeleton\helper\validator;
20 | use phpbb\user;
21 | use Symfony\Component\Console\Exception\LogicException;
22 | use Symfony\Component\Console\Helper\QuestionHelper;
23 | use Symfony\Component\Console\Input\InputInterface;
24 | use Symfony\Component\Console\Output\OutputInterface;
25 | use Symfony\Component\Console\Question\ChoiceQuestion;
26 | use Symfony\Component\Console\Question\ConfirmationQuestion;
27 | use Symfony\Component\Console\Question\Question;
28 |
29 | class create extends command
30 | {
31 | /** @var array user input data array */
32 | protected $data = [];
33 |
34 | /** @var QuestionHelper $helper */
35 | protected $helper;
36 |
37 | /** @var InputInterface */
38 | protected $input;
39 |
40 | /** @var OutputInterface */
41 | protected $output;
42 |
43 | /** @var language */
44 | protected $language;
45 |
46 | /** @var packager */
47 | protected $packager;
48 |
49 | /** @var validator */
50 | protected $validator;
51 |
52 | /**
53 | * Constructor
54 | *
55 | * @param user $user
56 | * @param language $language
57 | * @param packager $packager
58 | * @param validator $validator
59 | */
60 | public function __construct(user $user, language $language, packager $packager, validator $validator)
61 | {
62 | $this->language = $language;
63 | $this->packager = $packager;
64 | $this->validator = $validator;
65 |
66 | $this->language->add_lang('common', 'phpbb/skeleton');
67 | parent::__construct($user);
68 | }
69 |
70 | /**
71 | * {@inheritdoc}
72 | */
73 | protected function configure()
74 | {
75 | $this
76 | ->setName('extension:create')
77 | ->setDescription($this->language->lang('CLI_DESCRIPTION_SKELETON_CREATE'))
78 | ;
79 | }
80 |
81 | /**
82 | * Executes the command extension:create.
83 | *
84 | * Creates an extension skeleton
85 | *
86 | * @param InputInterface $input An InputInterface instance
87 | * @param OutputInterface $output An OutputInterface instance
88 | *
89 | * @see \phpbb\config\config::delete()
90 | *
91 | * @return int 0 if everything went fine, or an exit code
92 | *
93 | * @throws LogicException When this abstract method is not implemented
94 | */
95 | protected function execute(InputInterface $input, OutputInterface $output)
96 | {
97 | $this->packager->create_extension($this->data);
98 |
99 | $output->writeln($this->language->lang('EXTENSION_CLI_SKELETON_SUCCESS'));
100 |
101 | return 0;
102 | }
103 |
104 | /**
105 | * Interacts with the user.
106 | *
107 | * @param InputInterface $input An InputInterface instance
108 | * @param OutputInterface $output An OutputInterface instance
109 | */
110 | protected function interact(InputInterface $input, OutputInterface $output)
111 | {
112 | $this->input = $input;
113 | $this->output = $output;
114 |
115 | $this->helper = $this->getHelper('question');
116 |
117 | $output->writeln($this->language->lang('SKELETON_CLI_COMPOSER_QUESTIONS'));
118 | $this->get_composer_data();
119 |
120 | $output->writeln($this->language->lang('SKELETON_CLI_COMPONENT_QUESTIONS'));
121 | $this->get_component_data();
122 | }
123 |
124 | /**
125 | * Get composer data from the user
126 | */
127 | protected function get_composer_data()
128 | {
129 | $dialog_questions = $this->packager->get_composer_dialog_values();
130 | foreach ($dialog_questions['extension'] as $value => $default)
131 | {
132 | $this->data['extension'][$value] = $this->get_user_input($value, $default);
133 | }
134 |
135 | $question = new Question($this->language->lang('SKELETON_QUESTION_NUM_AUTHORS') . $this->language->lang('COLON'), 1);
136 | $question->setValidator([$this->validator, 'validate_num_authors']);
137 | $num_authors = $this->helper->ask($this->input, $this->output, $question);
138 |
139 | $this->data['authors'] = [];
140 | for ($i = 0; $i < $num_authors; $i++)
141 | {
142 | foreach ($dialog_questions['author'] as $value => $default)
143 | {
144 | $this->data['authors'][$i][$value] = $this->get_user_input($value, $default);
145 | }
146 | }
147 |
148 | foreach ($dialog_questions['requirements'] as $value => $default)
149 | {
150 | $this->data['requirements'][$value] = $this->get_user_input($value, $default);
151 | }
152 | }
153 |
154 | /**
155 | * Get component data from the user
156 | */
157 | protected function get_component_data()
158 | {
159 | $components = $this->packager->get_component_dialog_values();
160 | foreach ($components as $component => $details)
161 | {
162 | // Skip early as it's handled elsewhere
163 | if ($component === 'githubactions_custom')
164 | {
165 | continue;
166 | }
167 |
168 | // Check dependencies
169 | if (!$this->check_dependencies($details['dependencies']))
170 | {
171 | $this->data['components'][$component] = false;
172 | continue;
173 | }
174 |
175 | // Handle GitHub Actions
176 | if ($component === 'githubactions')
177 | {
178 | $this->handle_github_actions();
179 | continue;
180 | }
181 |
182 | // Default logic for all other components
183 | $this->data['components'][$component] = $this->get_user_input(
184 | 'component_' . $component,
185 | $details['default']
186 | );
187 | }
188 | }
189 |
190 | /**
191 | * Helper for getting user input
192 | *
193 | * @param string $value
194 | * @param mixed $default
195 | * @return mixed|string
196 | */
197 | protected function get_user_input($value, $default)
198 | {
199 | $dialog = $this->language->lang('SKELETON_QUESTION_' . strtoupper($value)) . $this->language->lang('COLON');
200 |
201 | if (method_exists($this->validator, 'validate_' . $value))
202 | {
203 | $question = new Question($dialog, $default);
204 | $question->setValidator([$this->validator, 'validate_' . $value]);
205 | $return_value = $this->helper->ask($this->input, $this->output, $question);
206 | }
207 | else if (is_bool($default))
208 | {
209 | $question = new ConfirmationQuestion($dialog, $default);
210 | $return_value = $this->helper->ask($this->input, $this->output, $question);
211 | }
212 | else
213 | {
214 | $question = new Question($dialog, $default);
215 | $return_value = $this->helper->ask($this->input, $this->output, $question);
216 | }
217 |
218 | return $return_value;
219 | }
220 |
221 | /**
222 | * Check if all dependencies are satisfied
223 | *
224 | * @param array $dependencies List of dependencies to check
225 | * @return bool
226 | */
227 | private function check_dependencies(array $dependencies): bool
228 | {
229 | foreach ($dependencies as $depends)
230 | {
231 | if (empty($this->data['components'][$depends]))
232 | {
233 | return false;
234 | }
235 | }
236 | return true;
237 | }
238 |
239 | /**
240 | * Handle GitHub Actions specific logic
241 | */
242 | private function handle_github_actions(): void
243 | {
244 | // Lookup table of GitHub Action component settings
245 | $github_actions_types = [
246 | 0 => ['githubactions' => false, 'githubactions_custom' => false], // No (default)
247 | 1 => ['githubactions' => true, 'githubactions_custom' => false], // Reusable
248 | 2 => ['githubactions' => false, 'githubactions_custom' => true], // Standalone
249 | ];
250 |
251 | $question_text = $this->language->lang('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS') . $this->language->lang('COLON');
252 | $choices = [];
253 | foreach (array_keys($github_actions_types) as $i)
254 | {
255 | $choices[] = $this->language->lang('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CLI', $i);
256 | }
257 |
258 | $question = new ChoiceQuestion($question_text, $choices, 0);
259 | $choice = $this->helper->ask($this->input, $this->output, $question);
260 | $index = array_search($choice, $choices, true);
261 |
262 | $component_settings = $github_actions_types[$index] ?? $github_actions_types[0];
263 | $this->data['components'] = array_merge(
264 | $this->data['components'] ?? [],
265 | $component_settings
266 | );
267 | }
268 | }
269 |
--------------------------------------------------------------------------------
/controller/main.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton\controller;
15 |
16 | use phpbb\config\config;
17 | use phpbb\controller\helper;
18 | use phpbb\exception\http_exception;
19 | use phpbb\language\language;
20 | use phpbb\request\request;
21 | use phpbb\skeleton\helper\packager;
22 | use phpbb\skeleton\helper\validator;
23 | use phpbb\template\template;
24 | use phpbb\user;
25 | use Symfony\Component\HttpFoundation\Response;
26 |
27 | class main
28 | {
29 | /** @var array */
30 | protected $data;
31 |
32 | /* @var config */
33 | protected $config;
34 |
35 | /* @var helper */
36 | protected $helper;
37 |
38 | /** @var language */
39 | protected $language;
40 |
41 | /* @var request */
42 | protected $request;
43 |
44 | /* @var packager */
45 | protected $packager;
46 |
47 | /* @var validator */
48 | protected $validator;
49 |
50 | /* @var template */
51 | protected $template;
52 |
53 | /* @var user */
54 | protected $user;
55 |
56 | /**
57 | * Constructor
58 | *
59 | * @param config $config
60 | * @param helper $helper
61 | * @param language $language
62 | * @param request $request
63 | * @param packager $packager
64 | * @param validator $validator
65 | * @param template $template
66 | * @param user $user
67 | */
68 | public function __construct(config $config, helper $helper, language $language, request $request, packager $packager, validator $validator, template $template, user $user)
69 | {
70 | $this->config = $config;
71 | $this->helper = $helper;
72 | $this->language = $language;
73 | $this->request = $request;
74 | $this->packager = $packager;
75 | $this->validator = $validator;
76 | $this->template = $template;
77 | $this->user = $user;
78 |
79 | $this->language->add_lang('common', 'phpbb/skeleton');
80 | }
81 |
82 | /**
83 | * Controller for route /skeleton
84 | *
85 | * @throws http_exception
86 | * @throws \Exception
87 | *
88 | * @return Response A Symfony Response object
89 | */
90 | public function handle()
91 | {
92 | if ($this->user->data['is_bot'])
93 | {
94 | throw new http_exception(403, 'NOT_AUTHORISED');
95 | }
96 |
97 | if ($this->request->is_set_post('submit'))
98 | {
99 | try
100 | {
101 | $this->get_composer_data();
102 | $this->get_component_data();
103 |
104 | $this->packager->create_extension($this->data);
105 | $filename = $this->packager->create_zip($this->data);
106 |
107 | $response = new Response($filename);
108 | $response->headers->set('Content-type', 'application/octet-stream');
109 | $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($filename) . '";');
110 | $response->headers->set('Content-length', filesize($filename));
111 | $response->sendHeaders();
112 | $response->setContent(readfile($filename));
113 |
114 | return $response;
115 | }
116 | catch (\Exception $e)
117 | {
118 | $this->template->assign_var('ERROR', $e->getMessage());
119 | }
120 | }
121 |
122 | $dialog_questions = $this->packager->get_composer_dialog_values();
123 | foreach ($dialog_questions['extension'] as $value => $default)
124 | {
125 | $this->template->assign_block_vars('extension', [
126 | 'NAME' => $value,
127 | 'DESC' => $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_UI'),
128 | 'DESC_EXPLAIN' => $this->language->is_set('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') ? $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') : '',
129 | 'VALUE' => $this->request->variable($value, (string) $default, true),
130 | ]);
131 | }
132 |
133 | $author_values = [];
134 | foreach ($dialog_questions['author'] as $value => $default)
135 | {
136 | $author_values[$value] = $this->request->variable($value, [(string) $default], true);
137 | }
138 |
139 | $num_authors = max(1, count($author_values['author_name']));
140 | for ($i = 0; $i < $num_authors; $i++)
141 | {
142 | foreach ($dialog_questions['author'] as $value => $default)
143 | {
144 | $this->template->assign_block_vars('author', [
145 | 'NAME' => $value,
146 | 'DESC' => $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_UI'),
147 | 'DESC_EXPLAIN' => $this->language->is_set('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') ? $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') : '',
148 | 'VALUE' => isset($author_values[$value][$i]) ? $author_values[$value][$i] : '',
149 | ]);
150 | }
151 | }
152 |
153 | foreach ($dialog_questions['requirements'] as $value => $default)
154 | {
155 | $this->template->assign_block_vars('requirement', [
156 | 'NAME' => $value,
157 | 'DESC' => $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_UI'),
158 | 'DESC_EXPLAIN' => $this->language->is_set('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') ? $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') : '',
159 | 'VALUE' => $this->request->variable($value, (string) $default),
160 | ]);
161 | }
162 |
163 | $components = $this->packager->get_component_dialog_values();
164 | foreach ($components as $component => $details)
165 | {
166 | $this->template->assign_block_vars('component_' . $details['group'], [
167 | 'NAME' => 'component_' . $component,
168 | 'DESC' => $this->language->lang('SKELETON_QUESTION_COMPONENT_' . strtoupper($component) . '_UI'),
169 | 'DESC_EXPLAIN' => $this->language->is_set('SKELETON_QUESTION_COMPONENT_' . strtoupper($component) . '_EXPLAIN') ? $this->language->lang('SKELETON_QUESTION_COMPONENT_' . strtoupper($component) . '_EXPLAIN') : '',
170 | 'VALUE' => $this->request->variable('component_' . $component, $details['default']),
171 | ]);
172 |
173 | $this->data['components'][$component] = $this->get_user_input('component_' . $component, $details['default']);
174 | }
175 |
176 | $phpbb_skeleton_controller = $this->helper->route('phpbb_skeleton_controller');
177 |
178 | $this->template->assign_var('S_POST_ACTION', $phpbb_skeleton_controller);
179 |
180 | // Create breadcrumbs
181 | $this->template->assign_block_vars('navlinks', [
182 | 'FORUM_NAME' => $this->language->lang('PHPBB_SKELETON_EXT'),
183 | 'U_VIEW_FORUM' => $phpbb_skeleton_controller,
184 | ]);
185 |
186 | return $this->helper->render('@phpbb_skeleton/skeleton_body.html', $this->language->lang('PHPBB_CREATE_SKELETON_EXT'));
187 | }
188 |
189 | /**
190 | * Get composer data
191 | */
192 | protected function get_composer_data()
193 | {
194 | $dialog_questions = $this->packager->get_composer_dialog_values();
195 | foreach ($dialog_questions['extension'] as $value => $default)
196 | {
197 | $this->data['extension'][$value] = $this->get_user_input($value, $default);
198 | }
199 |
200 | $num_authors = max(1, count($this->request->variable('author_name', [''], true)));
201 | for ($i = 0; $i < $num_authors; $i++)
202 | {
203 | foreach ($dialog_questions['author'] as $value => $default)
204 | {
205 | $this->data['authors'][$i][$value] = $this->get_user_input($value, $default, $i);
206 | }
207 | }
208 |
209 | foreach ($dialog_questions['requirements'] as $value => $default)
210 | {
211 | $this->data['requirements'][$value] = $this->get_user_input($value, $default);
212 | }
213 | }
214 |
215 | /**
216 | * Get components data
217 | */
218 | protected function get_component_data()
219 | {
220 | $components = $this->packager->get_component_dialog_values();
221 | foreach ($components as $component => $details)
222 | {
223 | foreach ($details['dependencies'] as $depends)
224 | {
225 | if (empty($this->data['components'][$depends]))
226 | {
227 | $this->data['components'][$component] = false;
228 | continue 2;
229 | }
230 | }
231 |
232 | $this->data['components'][$component] = $this->get_user_input('component_' . $component, $details['default']);
233 | }
234 | }
235 |
236 | /**
237 | * Get user input values
238 | *
239 | * @param string $value
240 | * @param mixed $default
241 | * @param null|int $array_key for multi user support
242 | *
243 | * @return mixed|string
244 | */
245 | protected function get_user_input($value, $default, $array_key = null)
246 | {
247 | $return_value = $this->get_request_variable($value, $default, $array_key);
248 |
249 | if (method_exists($this->validator, 'validate_' . $value))
250 | {
251 | $return_value = call_user_func([$this->validator, 'validate_' . $value], $return_value);
252 | }
253 |
254 | return $return_value;
255 | }
256 |
257 | /**
258 | * Get request variables
259 | *
260 | * @param string $value
261 | * @param mixed $default
262 | * @param null|int $array_key for multi user support
263 | *
264 | * @return mixed|string
265 | */
266 | protected function get_request_variable($value, $default, $array_key = null)
267 | {
268 | if (is_bool($default))
269 | {
270 | if ($array_key !== null)
271 | {
272 | $return_value = $this->request->variable($value, [$default]);
273 | return isset($return_value[$array_key]) ? $return_value[$array_key] : $default;
274 | }
275 |
276 | return $this->request->variable($value, $default);
277 | }
278 |
279 | if ($array_key !== null)
280 | {
281 | $return_value = $this->request->variable($value, [(string) $default], true);
282 | return isset($return_value[$array_key]) ? (string) $return_value[$array_key] : (string) $default;
283 | }
284 |
285 | return $this->request->variable($value, (string) $default, true);
286 | }
287 | }
288 |
--------------------------------------------------------------------------------
/event/main_listener.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton\event;
15 |
16 | /**
17 | * @ignore
18 | */
19 | use Symfony\Component\EventDispatcher\EventSubscriberInterface;
20 |
21 | /**
22 | * Event listener
23 | */
24 | class main_listener implements EventSubscriberInterface
25 | {
26 | public static function getSubscribedEvents()
27 | {
28 | return [
29 | 'core.user_setup' => 'load_language_on_setup',
30 | 'core.page_header' => 'add_page_header_link',
31 | ];
32 | }
33 |
34 | /* @var \phpbb\controller\helper */
35 | protected $helper;
36 |
37 | /* @var \phpbb\template\template */
38 | protected $template;
39 |
40 | /**
41 | * Constructor
42 | *
43 | * @param \phpbb\controller\helper $helper Controller helper object
44 | * @param \phpbb\template\template $template Template object
45 | */
46 | public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template)
47 | {
48 | $this->helper = $helper;
49 | $this->template = $template;
50 | }
51 |
52 | /**
53 | * Load language files
54 | *
55 | * @param \phpbb\event\data $event
56 | */
57 | public function load_language_on_setup($event)
58 | {
59 | $lang_set_ext = $event['lang_set_ext'];
60 | $lang_set_ext[] = [
61 | 'ext_name' => 'phpbb/skeleton',
62 | 'lang_set' => 'common',
63 | ];
64 | $event['lang_set_ext'] = $lang_set_ext;
65 | }
66 |
67 | /**
68 | * Add the page header link
69 | */
70 | public function add_page_header_link()
71 | {
72 | $this->template->assign_var('U_PHPBB_SKELETON_EXT', $this->helper->route('phpbb_skeleton_controller'));
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/ext.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton;
15 |
16 | class ext extends \phpbb\extension\base
17 | {
18 | public const DEFAULT_SKELETON_PHP = '7.1.3';
19 | public const DEFAULT_SKELETON_PHPBB_MIN = '3.3.0';
20 | public const DEFAULT_SKELETON_PHPBB_MAX = '4.0.0@dev';
21 |
22 | public const MIN_PHPBB_ALLOWED = '3.3.0';
23 | public const MAX_PHPBB_ALLOWED = '4.0.0-dev';
24 | public const MIN_PHP_ALLOWED = 70100;
25 |
26 | /**
27 | * @var array An array of installation error messages
28 | */
29 | protected $errors = [];
30 |
31 | /**
32 | * Check whether the extension can be enabled.
33 | *
34 | * @return bool|array True if it can be enabled. False if not, or an array of error messages in phpBB 3.3.
35 | */
36 | public function is_enableable()
37 | {
38 | // Check requirements
39 | $this->phpbb_requirement();
40 | $this->php_requirement();
41 | $this->ziparchive_exists();
42 |
43 | return count($this->errors) ? $this->enable_failed() : true;
44 | }
45 |
46 | /**
47 | * Check phpBB requirements.
48 | *
49 | * @param string $phpBB_version
50 | * @return void
51 | */
52 | protected function phpbb_requirement($phpBB_version = PHPBB_VERSION)
53 | {
54 | if (phpbb_version_compare($phpBB_version, self::MIN_PHPBB_ALLOWED, '<'))
55 | {
56 | $this->errors[] = 'PHPBB_VERSION_MIN_ERROR';
57 | }
58 | else if (phpbb_version_compare($phpBB_version, self::MAX_PHPBB_ALLOWED, '>='))
59 | {
60 | $this->errors[] = 'PHPBB_VERSION_MAX_ERROR';
61 | }
62 | }
63 |
64 | /**
65 | * Check PHP minimum requirement.
66 | *
67 | * @param int $php_version
68 | * @return void
69 | */
70 | protected function php_requirement($php_version = PHP_VERSION_ID)
71 | {
72 | if ($php_version < self::MIN_PHP_ALLOWED)
73 | {
74 | $this->errors[] = 'PHP_VERSION_ERROR';
75 | }
76 | }
77 |
78 | /**
79 | * Check PHP ZipArchive binary requirement.
80 | *
81 | * @param string $zip_class
82 | * @return void
83 | */
84 | protected function ziparchive_exists($zip_class = 'ZipArchive')
85 | {
86 | if (!class_exists($zip_class, false))
87 | {
88 | $this->errors[] = 'NO_ZIPARCHIVE_ERROR';
89 | }
90 | }
91 |
92 | /**
93 | * Generate the best enable failed response for the current phpBB environment.
94 | * Return error messages in phpBB 3.3 or newer. Return boolean false otherwise.
95 | *
96 | * @return array|bool
97 | */
98 | protected function enable_failed()
99 | {
100 | if (phpbb_version_compare(PHPBB_VERSION, '3.3.0-b1', '>='))
101 | {
102 | $language = $this->container->get('language');
103 | $language->add_lang('common', 'phpbb/skeleton');
104 | return array_map([$language, 'lang'], $this->errors);
105 | }
106 |
107 | return false;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/helper/packager.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton\helper;
15 |
16 | use phpbb\config\config;
17 | use phpbb\di\service_collection;
18 | use phpbb\filesystem\filesystem;
19 | use phpbb\skeleton\ext;
20 | use phpbb\skeleton\template\twig\extension\skeleton_version_compare;
21 | use phpbb\template\context;
22 | use phpbb\template\twig\environment;
23 | use phpbb\template\twig\loader;
24 | use phpbb\template\twig\twig;
25 | use Symfony\Component\DependencyInjection\ContainerInterface;
26 | use Symfony\Component\Finder\Finder;
27 |
28 | class packager
29 | {
30 | /** @var ContainerInterface */
31 | protected $phpbb_container;
32 |
33 | /** @var service_collection */
34 | protected $collection;
35 |
36 | /** @var string */
37 | protected $root_path;
38 |
39 | /**
40 | * Constructor
41 | *
42 | * @param ContainerInterface $phpbb_container Container
43 | * @param service_collection $collection Service collection
44 | * @param string $root_path phpBB root path
45 | */
46 | public function __construct(ContainerInterface $phpbb_container, service_collection $collection, $root_path)
47 | {
48 | $this->phpbb_container = $phpbb_container;
49 | $this->collection = $collection;
50 | $this->root_path = $root_path;
51 | }
52 |
53 | /**
54 | * Get composer dialog values
55 | *
56 | * @return array
57 | */
58 | public function get_composer_dialog_values()
59 | {
60 | return [
61 | 'author' => [
62 | 'author_name' => null,
63 | 'author_email' => null,
64 | 'author_homepage' => null,
65 | 'author_role' => null,
66 | ],
67 | 'extension' => [
68 | 'vendor_name' => null,
69 | 'extension_name' => null,
70 | 'extension_display_name' => null,
71 | 'extension_description' => null,
72 | 'extension_version' => '1.0.0-dev',
73 | 'extension_time' => date('Y-m-d'),
74 | 'extension_homepage' => null,
75 | ],
76 | 'requirements' => [
77 | 'php_version' => '>=' . ext::DEFAULT_SKELETON_PHP,
78 | 'phpbb_version_min' => '>=' . ext::DEFAULT_SKELETON_PHPBB_MIN,
79 | 'phpbb_version_max' => '<' . ext::DEFAULT_SKELETON_PHPBB_MAX,
80 | ],
81 | ];
82 | }
83 |
84 | /**
85 | * Get components dialog values
86 | *
87 | * @return array
88 | */
89 | public function get_component_dialog_values()
90 | {
91 | $components = [];
92 | foreach ($this->collection as $service)
93 | {
94 | /** @var \phpbb\skeleton\skeleton $service */
95 | $components[$service->get_name()] = [
96 | 'default' => $service->get_default(),
97 | 'dependencies' => $service->get_dependencies(),
98 | 'files' => $service->get_files(),
99 | 'group' => $service->get_group(),
100 | ];
101 | }
102 |
103 | return $components;
104 | }
105 |
106 | /**
107 | * Create the extension
108 | *
109 | * @param array $data Extension data
110 | */
111 | public function create_extension($data)
112 | {
113 | $ext_path = $this->root_path . 'store/tmp-ext/' . "{$data['extension']['vendor_name']}/{$data['extension']['extension_name']}/";
114 | $filesystem = new filesystem();
115 | $filesystem->remove($this->root_path . 'store/tmp-ext');
116 | $filesystem->mkdir($ext_path);
117 |
118 | $template = $this->get_template_engine();
119 | $template->set_custom_style('skeletonextension', $this->root_path . 'ext/phpbb/skeleton/skeleton');
120 | $template->assign_vars([
121 | 'COMPONENT' => $data['components'],
122 | 'EXTENSION' => $data['extension'],
123 | 'REQUIREMENTS' => $data['requirements'],
124 | 'AUTHORS' => $data['authors'],
125 | 'LANGUAGE' => $this->get_language_version_data($data),
126 | ]);
127 |
128 | $component_data = $this->get_component_dialog_values();
129 | $skeleton_files[] = [
130 | 'composer.json',
131 | 'license.txt',
132 | 'README.md',
133 | ];
134 |
135 | foreach ($data['components'] as $component => $selected)
136 | {
137 | if ($selected && !empty($component_data[$component]['files']))
138 | {
139 | $skeleton_files[] = $component_data[$component]['files'];
140 | }
141 | }
142 | $skeleton_files = array_merge(...$skeleton_files);
143 |
144 | foreach ($skeleton_files as $file)
145 | {
146 | $body = $template
147 | ->set_filenames(['body' => $file . '.twig'])
148 | ->assign_display('body');
149 | $filesystem->dump_file($ext_path . str_replace('demo', strtolower($data['extension']['extension_name']), $file), trim($body) . "\n");
150 | }
151 | }
152 |
153 | /**
154 | * Create the zip archive
155 | *
156 | * @param array $data Extension data
157 | *
158 | * @return string
159 | */
160 | public function create_zip($data)
161 | {
162 | $tmp_path = $this->root_path . 'store/tmp-ext/';
163 | $ext_path = "{$data['extension']['vendor_name']}/{$data['extension']['extension_name']}/";
164 | $zip_path = $tmp_path . "{$data['extension']['vendor_name']}_{$data['extension']['extension_name']}-{$data['extension']['extension_version']}.zip";
165 |
166 | $zip_archive = new \ZipArchive();
167 | $zip_archive->open($zip_path, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
168 |
169 | $finder = new Finder();
170 | $finder->ignoreDotFiles(false)
171 | ->ignoreVCS(false)
172 | ->files()
173 | ->in($tmp_path . $ext_path);
174 |
175 | foreach ($finder as $file)
176 | {
177 | $zip_archive->addFile(
178 | $file->getRealPath(),
179 | $ext_path . $file->getRelativePath() . DIRECTORY_SEPARATOR . $file->getFilename()
180 | );
181 | }
182 |
183 | $zip_archive->close();
184 |
185 | return $zip_path;
186 | }
187 |
188 | /**
189 | * Get the template engine to use for parsing skeleton templates.
190 | *
191 | * @return twig Template object
192 | */
193 | protected function get_template_engine()
194 | {
195 | $config = new config([
196 | 'load_tplcompile' => true,
197 | 'tpl_allow_php' => false,
198 | 'assets_version' => null,
199 | ]);
200 |
201 | $container = $this->phpbb_container;
202 | $path_helper = $container->get('path_helper');
203 | $filesystem = $container->get('filesystem');
204 | $cache_dir = $container->getParameter('core.cache_dir');
205 | $ext_manager = $container->get('ext.manager');
206 |
207 | $is_phpbb_4 = defined('PHPBB_VERSION') &&
208 | phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '>=');
209 |
210 | $args = $is_phpbb_4
211 | ? [
212 | $container->get('assets.bag'),
213 | $config,
214 | $filesystem,
215 | $path_helper,
216 | $cache_dir,
217 | $ext_manager,
218 | new loader()
219 | ]
220 | : [
221 | $config,
222 | $filesystem,
223 | $path_helper,
224 | $cache_dir,
225 | $ext_manager,
226 | new loader(new filesystem())
227 | ];
228 |
229 | $environment = new environment(...$args);
230 |
231 | // Custom filter for use by packager to decode greater/less than symbols
232 | $filter = new \Twig\TwigFilter('skeleton_decode', function ($string) {
233 | return str_replace(['<', '>'], ['<', '>'], $string);
234 | }, ['is_safe' => ['html']]);
235 | $environment->addFilter($filter);
236 |
237 | return new twig(
238 | $path_helper,
239 | $config,
240 | new context(),
241 | $environment,
242 | $cache_dir,
243 | $container->get('user'),
244 | [
245 | new skeleton_version_compare()
246 | ]
247 | );
248 | }
249 |
250 | /**
251 | * Get an array of language class and methods depending on 3.1 or 3.2
252 | * compatibility, for use in the skeleton twig templates.
253 | *
254 | * @param array $data Extension data
255 | *
256 | * @return array An array of language data
257 | */
258 | protected function get_language_version_data($data)
259 | {
260 | $phpbb_31 = false;
261 | if (isset($data['requirements']['phpbb_version_min']))
262 | {
263 | $phpbb_31 = (bool) preg_match('/^\D*3\.1.*$/', $data['requirements']['phpbb_version_min']);
264 | }
265 |
266 | return [
267 | 'class' => $phpbb_31 ? '\phpbb\user' : '\phpbb\language\language',
268 | 'object' => $phpbb_31 ? 'user' : 'language',
269 | 'function' => $phpbb_31 ? 'add_lang_ext' : 'add_lang',
270 | 'indent' => [
271 | 'class' => $phpbb_31 ? "\t\t\t" : '',
272 | 'object' => $phpbb_31 ? "\t" : '',
273 | ],
274 | ];
275 | }
276 | }
277 |
--------------------------------------------------------------------------------
/helper/validator.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton\helper;
15 |
16 | use phpbb\exception\runtime_exception;
17 | use phpbb\language\language;
18 |
19 | class validator
20 | {
21 | /** @var language */
22 | protected $language;
23 |
24 | /**
25 | * Constructor
26 | *
27 | * @param language $language
28 | */
29 | public function __construct(language $language)
30 | {
31 | $this->language = $language;
32 | }
33 |
34 | /**
35 | * Validate the number of authors
36 | * Should be between 1 and 20
37 | *
38 | * @param string $value The value to validate
39 | * @return string The valid value
40 | * @throws runtime_exception
41 | */
42 | public function validate_num_authors($value)
43 | {
44 | if ($value > 0 && $value <= 20 && ctype_digit($value))
45 | {
46 | return $value;
47 | }
48 |
49 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_NUM_AUTHORS'));
50 | }
51 |
52 | /**
53 | * Validate and require the extension name
54 | *
55 | * @param string $value The value to validate
56 | * @return string The valid value
57 | * @throws runtime_exception
58 | */
59 | public function validate_extension_name($value)
60 | {
61 | if (preg_match('#^[a-z][a-z0-9]*$#', $value))
62 | {
63 | return $value;
64 | }
65 |
66 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_PACKAGE_NAME'));
67 | }
68 |
69 | /**
70 | * Validate and require the extension display name
71 | *
72 | * @param string $value The value to validate
73 | * @return string The valid value
74 | * @throws runtime_exception
75 | */
76 | public function validate_extension_display_name($value)
77 | {
78 | if ((string) $value !== '' && strpos($value, '"') === false)
79 | {
80 | return htmlspecialchars_decode($value, ENT_NOQUOTES);
81 | }
82 |
83 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_DISPLAY_NAME'));
84 | }
85 |
86 | /**
87 | * Validate and require the extension date/time
88 | *
89 | * @param string $value The value to validate
90 | * @return string The valid value
91 | * @throws runtime_exception
92 | */
93 | public function validate_extension_time($value)
94 | {
95 | if (preg_match('#^\d{4}-\d{2}-\d{2}$#', $value))
96 | {
97 | return $value;
98 | }
99 |
100 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_EXTENSION_TIME'));
101 | }
102 |
103 | /**
104 | * Validate and require the extension version number
105 | *
106 | * @param string $value The value to validate
107 | * @return string The valid value
108 | * @throws runtime_exception
109 | */
110 | public function validate_extension_version($value)
111 | {
112 | if (preg_match('#^\d+(\.\d){1,3}(-(((?:a|b|RC|pl)\d+)|dev))?$#', $value))
113 | {
114 | return $value;
115 | }
116 |
117 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_EXTENSION_VERSION'));
118 | }
119 |
120 | /**
121 | * Validate and require the extension vendor name
122 | *
123 | * @param string $value The value to validate
124 | * @return string The valid value
125 | * @throws runtime_exception
126 | */
127 | public function validate_vendor_name($value)
128 | {
129 | if ($value !== 'core' && preg_match('#^[a-z][a-z0-9]*$#', $value))
130 | {
131 | return $value;
132 | }
133 |
134 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_VENDOR_NAME'));
135 | }
136 |
137 | /**
138 | * Validate the extension homepage URL
139 | *
140 | * @param string $value The value to validate
141 | * @return string The valid value
142 | * @throws runtime_exception
143 | */
144 | public function validate_extension_homepage($value)
145 | {
146 | if ((string) $value !== '' && filter_var($value, FILTER_VALIDATE_URL) === false)
147 | {
148 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_EXTENSION_URL'));
149 | }
150 |
151 | return $value;
152 | }
153 |
154 | /**
155 | * Validate the author homepage URL
156 | *
157 | * @param string $value The value to validate
158 | * @return string The valid value
159 | * @throws runtime_exception
160 | */
161 | public function validate_author_homepage($value)
162 | {
163 | if ((string) $value !== '' && filter_var($value, FILTER_VALIDATE_URL) === false)
164 | {
165 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_AUTHOR_URL'));
166 | }
167 |
168 | return $value;
169 | }
170 |
171 | /**
172 | * Validate the author email
173 | *
174 | * @param string $value The value to validate
175 | * @return string The valid value
176 | * @throws runtime_exception
177 | */
178 | public function validate_author_email($value)
179 | {
180 | if ((string) $value !== '' && filter_var($value, FILTER_VALIDATE_EMAIL) === false)
181 | {
182 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_AUTHOR_EMAIL'));
183 | }
184 |
185 | return $value;
186 | }
187 |
188 | /**
189 | * Validate and require the phpBB minimum version
190 | *
191 | * @param string $value The value to validate
192 | * @return string The valid value
193 | * @throws runtime_exception
194 | */
195 | public function validate_phpbb_version_min($value)
196 | {
197 | if ($this->check_version($value))
198 | {
199 | return $value;
200 | }
201 |
202 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_PHPBB_MIN_VERSION'));
203 |
204 | }
205 |
206 | /**
207 | * Validate and require the phpBB maximum version
208 | *
209 | * @param string $value The value to validate
210 | * @return string The valid value
211 | * @throws runtime_exception
212 | */
213 | public function validate_phpbb_version_max($value)
214 | {
215 | if ($this->check_version($value))
216 | {
217 | return $value;
218 | }
219 |
220 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_PHPBB_MAX_VERSION'));
221 |
222 | }
223 |
224 | /**
225 | * Validate and require the PHP version
226 | *
227 | * @param string $value The value to validate
228 | * @return string The valid value
229 | * @throws runtime_exception
230 | */
231 | public function validate_php_version($value)
232 | {
233 | if ($this->check_version($value))
234 | {
235 | return $value;
236 | }
237 |
238 | throw new runtime_exception($this->language->lang('SKELETON_INVALID_PHP_VERSION'));
239 |
240 | }
241 |
242 | /**
243 | * Version value check. Checks for values like:
244 | * 1.0.0-RC1
245 | * >=1.0.0
246 | * <1.0@dev
247 | *
248 | * @param string $value The value to check
249 | * @return bool True if valid, false if not
250 | */
251 | protected function check_version($value)
252 | {
253 | return (bool) preg_match('/^[<>=]*[\d+][\w.@-]+$/', htmlspecialchars_decode($value, ENT_NOQUOTES));
254 | }
255 | }
256 |
--------------------------------------------------------------------------------
/language/en/common.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | if (!defined('IN_PHPBB'))
15 | {
16 | exit;
17 | }
18 |
19 | if (empty($lang) || !is_array($lang))
20 | {
21 | $lang = [];
22 | }
23 |
24 | $lang = array_merge($lang, [
25 | 'CLI_DESCRIPTION_SKELETON_CREATE' => 'Create a basic skeleton extension',
26 | 'PHPBB_SKELETON_EXT' => 'Skeleton Extension',
27 | 'PHPBB_CREATE_SKELETON_EXT' => 'Create a Skeleton Extension',
28 | 'PHPBB_CREATE_SKELETON_EXPLAIN' => 'Generate your extension’s foundation in seconds. No more setting up files by hand — Skeleton builds it all for you, with clean, fully documented templates based on phpBB’s best practices. Before you begin, be sure to review the 📖 [Skeleton Extension Documentation], 🛡️ [Extension Validation Rules], and 🛠️ [Coding Guidelines].',
29 | 'PHPBB_SKELETON_EXT_HELP' => 'Learn More',
30 |
31 | 'EXTENSION_CLI_SKELETON_SUCCESS' => "Extension created successfully.\nCopy the extension from `store/tmp-ext/` into the `ext/` folder.",
32 | 'SKELETON_CLI_COMPOSER_QUESTIONS' => 'Enter composer.json details (hit enter to leave an option empty)',
33 | 'SKELETON_CLI_COMPONENT_QUESTIONS' => 'Install optional components. Default: No; [y/n]',
34 |
35 | 'SKELETON_RESERVED_NAME_WARNING_UI' => 'Warning: The name entered is not allowed.',
36 |
37 | 'SKELETON_ADD_AUTHOR' => 'Add author',
38 | 'SKELETON_QUESTION_VENDOR_NAME' => 'Please enter the vendor name',
39 | 'SKELETON_QUESTION_VENDOR_NAME_UI' => 'Vendor name',
40 | 'SKELETON_QUESTION_VENDOR_NAME_EXPLAIN' => 'Starting with a letter, lowercase letters and numbers only',
41 | 'SKELETON_QUESTION_EXTENSION_NAME' => 'Please enter the package (folder) name of the extension',
42 | 'SKELETON_QUESTION_EXTENSION_NAME_UI' => 'Package name',
43 | 'SKELETON_QUESTION_EXTENSION_NAME_EXPLAIN' => 'Starting with a letter, lowercase letters and numbers only',
44 | 'SKELETON_QUESTION_EXTENSION_DISPLAY_NAME' => 'Please enter the display name (title) of the extension',
45 | 'SKELETON_QUESTION_EXTENSION_DISPLAY_NAME_UI' => 'Display name',
46 | 'SKELETON_QUESTION_EXTENSION_DISPLAY_NAME_EXPLAIN' => 'This is the name (title) of the extension',
47 | 'SKELETON_QUESTION_EXTENSION_DESCRIPTION' => 'Please enter the Description of the extension',
48 | 'SKELETON_QUESTION_EXTENSION_DESCRIPTION_UI'=> 'Description',
49 | 'SKELETON_QUESTION_EXTENSION_VERSION' => 'Please enter the version of the extension',
50 | 'SKELETON_QUESTION_EXTENSION_VERSION_UI' => 'Version',
51 | 'SKELETON_QUESTION_EXTENSION_VERSION_EXPLAIN' => 'e.g. 1.0.0-dev',
52 | 'SKELETON_QUESTION_EXTENSION_HOMEPAGE' => 'Please enter the homepage of the extension',
53 | 'SKELETON_QUESTION_EXTENSION_HOMEPAGE_UI' => 'Homepage of the extension',
54 | 'SKELETON_QUESTION_EXTENSION_TIME' => 'Please enter the date of the extension',
55 | 'SKELETON_QUESTION_EXTENSION_TIME_UI' => 'Date of the extension',
56 | 'SKELETON_QUESTION_EXTENSION_TIME_EXPLAIN' => 'YYYY-MM-DD, default: today',
57 |
58 | 'SKELETON_QUESTION_NUM_AUTHORS' => 'How many authors does the extension have',
59 | 'SKELETON_QUESTION_NUM_AUTHORS_EXPLAIN' => 'default: 1',
60 |
61 | 'SKELETON_QUESTION_AUTHOR_NAME' => 'Please enter the author name',
62 | 'SKELETON_QUESTION_AUTHOR_NAME_UI' => 'Author name',
63 | 'SKELETON_QUESTION_AUTHOR_NAME_EXPLAIN' => 'Must not be empty',
64 | 'SKELETON_QUESTION_AUTHOR_EMAIL' => 'Please enter the author email',
65 | 'SKELETON_QUESTION_AUTHOR_EMAIL_UI' => 'Author email',
66 | 'SKELETON_QUESTION_AUTHOR_HOMEPAGE' => 'Please enter the author homepage',
67 | 'SKELETON_QUESTION_AUTHOR_HOMEPAGE_UI' => 'Author homepage',
68 | 'SKELETON_QUESTION_AUTHOR_ROLE' => 'Please enter the author role',
69 | 'SKELETON_QUESTION_AUTHOR_ROLE_UI' => 'Author role',
70 |
71 | 'SKELETON_QUESTION_PHP_VERSION' => 'Please enter the PHP requirement of the extension',
72 | 'SKELETON_QUESTION_PHP_VERSION_UI' => 'PHP requirement of the extension',
73 | 'SKELETON_QUESTION_PHP_VERSION_EXPLAIN' => 'default: >=' . \phpbb\skeleton\ext::DEFAULT_SKELETON_PHP,
74 | 'SKELETON_QUESTION_PHPBB_VERSION_MIN' => 'Please enter the minimum phpBB requirement of the extension',
75 | 'SKELETON_QUESTION_PHPBB_VERSION_MIN_UI' => 'Minimum phpBB requirement of the extension',
76 | 'SKELETON_QUESTION_PHPBB_VERSION_MIN_EXPLAIN' => 'default: >=' . \phpbb\skeleton\ext::DEFAULT_SKELETON_PHPBB_MIN,
77 | 'SKELETON_QUESTION_PHPBB_VERSION_MAX' => 'Please enter the maximum phpBB requirement of the extension',
78 | 'SKELETON_QUESTION_PHPBB_VERSION_MAX_UI' => 'Maximum phpBB requirement of the extension',
79 | 'SKELETON_QUESTION_PHPBB_VERSION_MAX_EXPLAIN' => 'default: <' . \phpbb\skeleton\ext::DEFAULT_SKELETON_PHPBB_MAX,
80 |
81 | 'SKELETON_QUESTION_COMPONENT_PHPLISTENER' => 'Create sample PHP event listeners',
82 | 'SKELETON_QUESTION_COMPONENT_PHPLISTENER_UI' => 'PHP event listeners',
83 | 'SKELETON_QUESTION_COMPONENT_PHPLISTENER_EXPLAIN' => 'PHP event listeners work with core events to inject code into phpBB.',
84 | 'SKELETON_QUESTION_COMPONENT_HTMLLISTENER' => 'Create sample styles listeners',
85 | 'SKELETON_QUESTION_COMPONENT_HTMLLISTENER_UI' => 'Style listeners',
86 | 'SKELETON_QUESTION_COMPONENT_HTMLLISTENER_EXPLAIN' => 'Style listeners use template events to inject HTML, JS and CSS into phpBB’s style files.',
87 | 'SKELETON_QUESTION_COMPONENT_ACP' => 'Create a sample ACP administration module',
88 | 'SKELETON_QUESTION_COMPONENT_ACP_UI' => 'Administration control panel (ACP)',
89 | 'SKELETON_QUESTION_COMPONENT_ACP_EXPLAIN' => 'Add a functional ACP module for an extension to the ACP’s Extensions tab.',
90 | 'SKELETON_QUESTION_COMPONENT_MCP' => 'Create a sample MCP moderation module',
91 | 'SKELETON_QUESTION_COMPONENT_MCP_UI' => 'Moderator control panel (MCP)',
92 | 'SKELETON_QUESTION_COMPONENT_MCP_EXPLAIN' => 'Add a functional MCP module tab for an extension to the MCP.',
93 | 'SKELETON_QUESTION_COMPONENT_UCP' => 'Create a sample UCP user module',
94 | 'SKELETON_QUESTION_COMPONENT_UCP_UI' => 'User control panel (UCP)',
95 | 'SKELETON_QUESTION_COMPONENT_UCP_EXPLAIN' => 'Add a functional UCP module tab for an extension to the UCP.',
96 | 'SKELETON_QUESTION_COMPONENT_MIGRATION' => 'Create sample database migrations',
97 | 'SKELETON_QUESTION_COMPONENT_MIGRATION_UI' => 'Database migration',
98 | 'SKELETON_QUESTION_COMPONENT_MIGRATION_EXPLAIN' => 'Migration files are used to make database changes.',
99 | 'SKELETON_QUESTION_COMPONENT_SERVICE' => 'Create a sample service',
100 | 'SKELETON_QUESTION_COMPONENT_SERVICE_UI' => 'Service',
101 | 'SKELETON_QUESTION_COMPONENT_SERVICE_EXPLAIN' => 'This is a PHP class that does something behind the scenes. It is a class that can be accessed by controllers, event listeners, or control panel modules.',
102 | 'SKELETON_QUESTION_COMPONENT_CONTROLLER' => 'Create a sample controller',
103 | 'SKELETON_QUESTION_COMPONENT_CONTROLLER_UI' => 'Controller (front page)',
104 | 'SKELETON_QUESTION_COMPONENT_CONTROLLER_EXPLAIN'=> 'Controllers are typically used for the front-facing files/classes. They run the code that produces the page the user views.',
105 | 'SKELETON_QUESTION_COMPONENT_EXT' => 'Create a sample ext.php',
106 | 'SKELETON_QUESTION_COMPONENT_EXT_UI' => 'Extension base (ext.php)',
107 | 'SKELETON_QUESTION_COMPONENT_EXT_EXPLAIN' => 'Create the optional ext.php file which can be used to run code before or during extension installation and removal.',
108 | 'SKELETON_QUESTION_COMPONENT_CONSOLE' => 'Create a sample console command',
109 | 'SKELETON_QUESTION_COMPONENT_CONSOLE_UI' => 'Console command',
110 | 'SKELETON_QUESTION_COMPONENT_CONSOLE_EXPLAIN' => 'A functional CLI interface to perform console/terminal commands.',
111 | 'SKELETON_QUESTION_COMPONENT_CRON' => 'Create a sample cron task',
112 | 'SKELETON_QUESTION_COMPONENT_CRON_UI' => 'Cron task',
113 | 'SKELETON_QUESTION_COMPONENT_CRON_EXPLAIN' => 'Add a cron task to be able to schedule and run cron-based actions from an extension.',
114 | 'SKELETON_QUESTION_COMPONENT_NOTIFICATION' => 'Create a sample notification',
115 | 'SKELETON_QUESTION_COMPONENT_NOTIFICATION_UI' => 'Notifications',
116 | 'SKELETON_QUESTION_COMPONENT_NOTIFICATION_EXPLAIN' => 'Notifications allow an extension to notify users of specific activities. When choosing notifications, do not use phpBB 3.1 as the minimum requirement. Notifications changed in phpBB 3.2.0 and are not backwards compatible with 3.1.x.',
117 | 'SKELETON_QUESTION_COMPONENT_PERMISSIONS' => 'Create sample permissions',
118 | 'SKELETON_QUESTION_COMPONENT_PERMISSIONS_UI' => 'Permissions',
119 | 'SKELETON_QUESTION_COMPONENT_PERMISSIONS_EXPLAIN' => 'Permissions can be used to grant users, groups and roles access to specific extension features.',
120 | 'SKELETON_QUESTION_COMPONENT_TESTS' => 'Create sample PHPUnit tests',
121 | 'SKELETON_QUESTION_COMPONENT_TESTS_UI' => 'Tests (PHPUnit)',
122 | 'SKELETON_QUESTION_COMPONENT_TESTS_EXPLAIN' => 'Unit tests can test an extension to verify that specific portions of its source code work properly. This helps ensure basic code integrity and prevents regressions as an extension is being developed and debugged.',
123 | 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS' => 'Create a GitHub Actions workflow',
124 | 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CLI' => [
125 | 0 => 'No (Default)',
126 | 1 => 'Reusable (Recommended - uses phpBB\'s maintained workflow)',
127 | 2 => 'Standalone (Deprecated - customise and maintain your own workflow)',
128 | ],
129 | 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_UI' => 'GitHub Actions Workflow (Reusable – Recommended)',
130 | '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.',
131 | 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM' => 'Create a standalone GitHub Actions workflow [Deprecated: not recommended unless you plan to modify jobs or steps]',
132 | 'SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CUSTOM_UI' => 'GitHub Actions Workflow (Standalone – Deprecated)',
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.',
134 | 'SKELETON_QUESTION_COMPONENT_BUILD' => 'Create a sample build script for phing',
135 | 'SKELETON_QUESTION_COMPONENT_BUILD_UI' => 'Build script (phing)',
136 | '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.',
137 |
138 | 'SKELETON_COMPONENT_GROUP_FRONT_END' => 'Front End (HTML)',
139 | 'SKELETON_COMPONENT_GROUP_BACK_END' => 'Back End (PHP)',
140 | 'SKELETON_COMPONENT_GROUP_DATABASE' => 'Database',
141 | 'SKELETON_COMPONENT_GROUP_CONTROL_PANELS' => 'Control Panels',
142 | 'SKELETON_COMPONENT_GROUP_OTHER' => 'Extras',
143 | 'SKELETON_COMPONENT_GROUP_TEST_DEPLOY' => 'Testing & Deployment',
144 |
145 | 'SKELETON_TITLE_EXTENSION_INFO' => 'Extension packaging',
146 | 'SKELETON_TITLE_AUTHOR_INFO' => 'Authors',
147 | 'SKELETON_TITLE_REQUIREMENT_INFO' => 'Requirements',
148 | 'SKELETON_TITLE_COMPONENT_INFO' => 'Components',
149 |
150 | 'SKELETON_INVALID_AUTHOR_EMAIL' => 'An author email is invalid',
151 | 'SKELETON_INVALID_AUTHOR_URL' => 'An author homepage URL is invalid',
152 | 'SKELETON_INVALID_DISPLAY_NAME' => 'The display name you provided is invalid',
153 | 'SKELETON_INVALID_EXTENSION_TIME' => 'The extension date you provided is invalid',
154 | 'SKELETON_INVALID_EXTENSION_URL' => 'The extension homepage URL is invalid',
155 | 'SKELETON_INVALID_EXTENSION_VERSION'=> 'The extension version you provided is invalid',
156 | 'SKELETON_INVALID_NUM_AUTHORS' => 'The number of authors you provided is invalid',
157 | 'SKELETON_INVALID_PACKAGE_NAME' => 'The package name you provided is invalid',
158 | 'SKELETON_INVALID_VENDOR_NAME' => 'The vendor name you provided is invalid',
159 | 'SKELETON_INVALID_PHP_VERSION' => 'The PHP version requirement is invalid.',
160 | 'SKELETON_INVALID_PHPBB_MIN_VERSION'=> 'The minimum phpBB version requirement is invalid.',
161 | 'SKELETON_INVALID_PHPBB_MAX_VERSION'=> 'The maximum phpBB version requirement is invalid.',
162 |
163 | 'NO_ZIPARCHIVE_ERROR' => 'The ZipArchive class is required, but was not found in your PHP configuration.',
164 | 'PHP_VERSION_ERROR' => 'PHP 5.6 or newer is required to use this extension.',
165 | 'PHPBB_VERSION_MIN_ERROR' => 'phpBB 3.2.3 or newer is required to use this extension.',
166 | 'PHPBB_VERSION_MAX_ERROR' => 'phpBB 4 is not supported with this version of the extension. Please check for a newer version of this extension.'
167 | ]);
168 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "phpbb-skeleton",
3 | "lockfileVersion": 2,
4 | "requires": true,
5 | "packages": {
6 | "": {
7 | "name": "phpbb-skeleton",
8 | "license": "GPL-2.0",
9 | "dependencies": {
10 | "primer-tooltips": "^2.0.0"
11 | }
12 | },
13 | "node_modules/primer-support": {
14 | "version": "5.0.0",
15 | "resolved": "https://registry.npmjs.org/primer-support/-/primer-support-5.0.0.tgz",
16 | "integrity": "sha512-inUxVSsGirn5IkPxBhFsMBgm8ZHyfOUmOWyDCN8cBXtbaLiCIAjHsPI46yS1zrWxnn0J2kvq8haomkrlHGF08g=="
17 | },
18 | "node_modules/primer-tooltips": {
19 | "version": "2.0.0",
20 | "resolved": "https://registry.npmjs.org/primer-tooltips/-/primer-tooltips-2.0.0.tgz",
21 | "integrity": "sha512-cNF3r3hG6sXLr71GbYyJw3BXCBhspW4FjzJ0Hx/BO+lP3XCrNAX/wqd57+vvnWSuaLif2O8s3/Prs3VBF50hVQ==",
22 | "dependencies": {
23 | "primer-support": "5.0.0"
24 | }
25 | }
26 | },
27 | "dependencies": {
28 | "primer-support": {
29 | "version": "5.0.0",
30 | "resolved": "https://registry.npmjs.org/primer-support/-/primer-support-5.0.0.tgz",
31 | "integrity": "sha512-inUxVSsGirn5IkPxBhFsMBgm8ZHyfOUmOWyDCN8cBXtbaLiCIAjHsPI46yS1zrWxnn0J2kvq8haomkrlHGF08g=="
32 | },
33 | "primer-tooltips": {
34 | "version": "2.0.0",
35 | "resolved": "https://registry.npmjs.org/primer-tooltips/-/primer-tooltips-2.0.0.tgz",
36 | "integrity": "sha512-cNF3r3hG6sXLr71GbYyJw3BXCBhspW4FjzJ0Hx/BO+lP3XCrNAX/wqd57+vvnWSuaLif2O8s3/Prs3VBF50hVQ==",
37 | "requires": {
38 | "primer-support": "5.0.0"
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "phpbb-skeleton",
3 | "author": "phpBB Limited",
4 | "license": "GPL-2.0",
5 | "scripts": {
6 | "build": "sass --load-path=node_modules --style=compressed styles/prosilver/theme/skeleton.scss styles/prosilver/theme/skeleton.css"
7 | },
8 | "dependencies": {
9 | "primer-tooltips": "^2.0.0"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/skeleton.php:
--------------------------------------------------------------------------------
1 |
7 | * @license GNU General Public License, version 2 (GPL-2.0)
8 | *
9 | * For full copyright and license information, please see
10 | * the docs/CREDITS.txt file.
11 | *
12 | */
13 |
14 | namespace phpbb\skeleton;
15 |
16 | class skeleton
17 | {
18 | /** @var string */
19 | protected $name;
20 |
21 | /** @var bool */
22 | protected $default;
23 |
24 | /** @var array */
25 | protected $dependencies;
26 |
27 | /** @var array */
28 | protected $files;
29 |
30 | /** @var string */
31 | protected $group;
32 |
33 | /**
34 | * Constructor
35 | *
36 | * @param string $name
37 | * @param bool $default
38 | * @param array $dependencies
39 | * @param array $files
40 | * @param string $group
41 | */
42 | public function __construct($name, $default, array $dependencies, array $files, $group)
43 | {
44 | $this->name = $name;
45 | $this->default = $default;
46 | $this->dependencies = $dependencies;
47 | $this->files = $files;
48 | $this->group = $group;
49 | }
50 |
51 | /**
52 | * Get name
53 | *
54 | * @return string
55 | */
56 | public function get_name()
57 | {
58 | return $this->name;
59 | }
60 |
61 | /**
62 | * Get default
63 | *
64 | * @return bool
65 | */
66 | public function get_default()
67 | {
68 | return $this->default;
69 | }
70 |
71 | /**
72 | * Get dependencies
73 | *
74 | * @return array
75 | */
76 | public function get_dependencies()
77 | {
78 | return $this->dependencies;
79 | }
80 |
81 | /**
82 | * Get files
83 | *
84 | * @return array
85 | */
86 | public function get_files()
87 | {
88 | return $this->files;
89 | }
90 |
91 | /**
92 | * Get group
93 | *
94 | * @return string
95 | */
96 | public function get_group()
97 | {
98 | return $this->group;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/skeleton/README.md.twig:
--------------------------------------------------------------------------------
1 | # {{ EXTENSION.extension_display_name }}
2 |
3 | This is a basic skeleton to help you start building a phpBB extension. Customise it as needed.
4 |
5 | ## Installation
6 |
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
10 |
11 | ## Extension Development Guide
12 |
13 | New to phpBB extension development?
14 | Start here: [phpBB Extension Development Guide](https://area51.phpbb.com/docs/dev/{{ skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "4.0", "<") ? '3.3.x' : 'master' }}/extensions/index.html)
15 |
16 | ## License
17 |
18 | Licensed under the [GNU General Public License v2](license.txt)
19 |
--------------------------------------------------------------------------------
/skeleton/acp/main_info.php.twig:
--------------------------------------------------------------------------------
1 | '\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\acp\main_module',
22 | 'title' => 'ACP_{{ EXTENSION.extension_name|upper }}_TITLE',
23 | 'modes' => [
24 | 'settings' => [
25 | 'title' => 'ACP_{{ EXTENSION.extension_name|upper }}',
26 | 'auth' => 'ext_{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} && {% if COMPONENT.permissions %}acl_a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}{% else %}acl_a_board{% endif %}',
27 | 'cat' => ['ACP_{{ EXTENSION.extension_name|upper }}_TITLE'],
28 | ],
29 | ],
30 | ];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/skeleton/acp/main_module.php.twig:
--------------------------------------------------------------------------------
1 | get('{{ EXTENSION.vendor_name }}.{{ EXTENSION.extension_name }}.controller.acp');
35 |
36 | // Load a template from adm/style for our ACP page
37 | $this->tpl_name = 'acp_{{ EXTENSION.extension_name|lower }}_body';
38 |
39 | // Set the page title for our ACP page
40 | $this->page_title = 'ACP_{{ EXTENSION.extension_name|upper }}_TITLE';
41 |
42 | // Make the $u_action url available in our ACP controller
43 | $acp_controller->set_page_url($this->u_action);
44 |
45 | // Load the display options handle in our ACP controller
46 | $acp_controller->display_options();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/skeleton/adm/style/acp_demo_body.html.twig:
--------------------------------------------------------------------------------
1 | {{ '{' }}% include 'overall_header.html' %}
2 |
3 |
' . $this->{{ LANGUAGE.object }}->lang('RETURN_UCP', '', '');
100 | trigger_error($message);
101 | }
102 | }
103 |
104 | $s_errors = !empty($errors);
105 |
106 | // Set output variables for display in the template
107 | $this->template->assign_vars([
108 | 'S_ERROR' => $s_errors,
109 | 'ERROR_MSG' => $s_errors ? implode(' ', $errors) : '',
110 |
111 | 'U_UCP_ACTION' => $this->u_action,
112 |
113 | 'S_USER_{{ EXTENSION.extension_name|upper }}' => $data['user_{{ EXTENSION.extension_name|lower }}'],
114 | ]);
115 | }
116 |
117 | /**
118 | * Set custom form action.
119 | *
120 | * @param string $u_action Custom form action
121 | * @return void
122 | */
123 | public function set_page_url($u_action)
124 | {
125 | $this->u_action = $u_action;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/skeleton/cron/task/sample.php.twig:
--------------------------------------------------------------------------------
1 | config = $config;
35 | }
36 |
37 | /**
38 | * Runs this cron task.
39 | *
40 | * @return void
41 | */
42 | public function run()
43 | {
44 | // Run your cron actions here...
45 |
46 | // Update the cron task run time here if it hasn't
47 | // already been done by your cron actions.
48 | $this->config->set('{{ EXTENSION.extension_name|lower }}_cron_last_run', time(), false);
49 | }
50 |
51 | /**
52 | * Returns whether this cron task can run, given current board configuration.
53 | *
54 | * For example, a cron task that prunes forums can only run when
55 | * forum pruning is enabled.
56 | *
57 | * @return bool
58 | */
59 | public function is_runnable()
60 | {
61 | return true;
62 | }
63 |
64 | /**
65 | * Returns whether this cron task should run now, because enough time
66 | * has passed since it was last run.
67 | *
68 | * @return bool
69 | */
70 | public function should_run()
71 | {
72 | return $this->config['{{ EXTENSION.extension_name|lower }}_cron_last_run'] < time() - $this->cron_frequency;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/skeleton/event/main_listener.php.twig:
--------------------------------------------------------------------------------
1 | 'load_language_on_setup',
33 | {% if COMPONENT.controller %}
34 | 'core.page_header' => 'add_page_header_link',
35 | 'core.viewonline_overwrite_location' => 'viewonline_page',
36 | {% endif %}
37 | {% endif %}
38 | {% if COMPONENT.phplistener %}
39 | 'core.display_forums_modify_template_vars' => 'display_forums_modify_template_vars',
40 | {% endif %}
41 | {% if COMPONENT.permissions %}
42 | 'core.permissions' => 'add_permissions',
43 | {% endif %}
44 | ];
45 | }
46 | {% if COMPONENT.controller or COMPONENT.phplistener %}
47 |
48 | /* @var {{ LANGUAGE.class }} */
49 | protected ${{ LANGUAGE.object }};
50 |
51 | {% if COMPONENT.controller %}
52 | /* @var \phpbb\controller\helper */
53 | protected $helper;
54 |
55 | /* @var \phpbb\template\template */
56 | protected $template;
57 |
58 | /** @var string phpEx */
59 | protected $php_ext;
60 |
61 | {% endif %}
62 | /**
63 | * Constructor
64 | *
65 | * @param {{ LANGUAGE.class ~ LANGUAGE.indent.class }} ${{ LANGUAGE.object ~ LANGUAGE.indent.object}} {{ LANGUAGE.object|capitalize }} object
66 | {% if COMPONENT.controller %}
67 | * @param \phpbb\controller\helper $helper Controller helper object
68 | * @param \phpbb\template\template $template Template object
69 | * @param string $php_ext phpEx
70 | {% endif %}
71 | */
72 | public function __construct({{ LANGUAGE.class }} ${{ LANGUAGE.object }}{% if COMPONENT.controller %}, \phpbb\controller\helper $helper, \phpbb\template\template $template, $php_ext{% endif %})
73 | {
74 | $this->{{ LANGUAGE.object ~ LANGUAGE.indent.object }} = ${{ LANGUAGE.object }};
75 | {% if COMPONENT.controller %}
76 | $this->helper = $helper;
77 | $this->template = $template;
78 | $this->php_ext = $php_ext;
79 | {% endif %}
80 | }
81 |
82 | /**
83 | * Load common language files during user setup
84 | *
85 | * @param \phpbb\event\data $event Event object
86 | */
87 | public function load_language_on_setup($event)
88 | {
89 | $lang_set_ext = $event['lang_set_ext'];
90 | $lang_set_ext[] = [
91 | 'ext_name' => '{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}',
92 | 'lang_set' => 'common',
93 | ];
94 | $event['lang_set_ext'] = $lang_set_ext;
95 | }
96 | {% if COMPONENT.controller %}
97 |
98 | /**
99 | * Add a link to the controller in the forum navbar
100 | */
101 | public function add_page_header_link()
102 | {
103 | $this->template->assign_vars([
104 | 'U_{{ EXTENSION.extension_name|upper }}_PAGE' => $this->helper->route('{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_controller', ['name' => 'world']),
105 | ]);
106 | }
107 |
108 | /**
109 | * Show users viewing {{ EXTENSION.extension_display_name }} page on the Who Is Online page
110 | *
111 | * @param \phpbb\event\data $event Event object
112 | */
113 | public function viewonline_page($event)
114 | {
115 | if ($event['on_page'][1] === 'app' && strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/demo') === 0)
116 | {
117 | $event['location'] = $this->{{ LANGUAGE.object }}->lang('VIEWING_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}');
118 | $event['location_url'] = $this->helper->route('{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_controller', ['name' => 'world']);
119 | }
120 | }
121 | {% endif %}
122 | {% endif %}
123 | {% if COMPONENT.phplistener %}
124 |
125 | /**
126 | * A sample PHP event
127 | * Modifies the names of the forums on index
128 | *
129 | * @param \phpbb\event\data $event Event object
130 | */
131 | public function display_forums_modify_template_vars($event)
132 | {
133 | $forum_row = $event['forum_row'];
134 | $forum_row['FORUM_NAME'] .= $this->{{ LANGUAGE.object }}->lang('{{ EXTENSION.extension_name|upper }}_EVENT');
135 | $event['forum_row'] = $forum_row;
136 | }
137 | {% endif %}
138 | {% if COMPONENT.permissions %}
139 |
140 | /**
141 | * Add permissions to the ACP -> Permissions settings page
142 | * This is where permissions are assigned language keys and
143 | * categories (where they will appear in the Permissions table):
144 | * actions|content|forums|misc|permissions|pm|polls|post
145 | * post_actions|posting|profile|settings|topic_actions|user_group
146 | *
147 | * Developers note: To control access to ACP, MCP and UCP modules, you
148 | * must assign your permissions in your module_info.php file. For example,
149 | * to allow only users with the a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} permission
150 | * access to your ACP module, you would set this in your acp/main_info.php:
151 | * 'auth' => 'ext_{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }} && acl_a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}'
152 | *
153 | * @param \phpbb\event\data $event Event object
154 | */
155 | public function add_permissions($event)
156 | {
157 | $permissions = $event['permissions'];
158 |
159 | $permissions['a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}'] = ['lang' => 'ACL_A_NEW_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}', 'cat' => 'misc'];
160 | $permissions['m_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}'] = ['lang' => 'ACL_M_NEW_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}', 'cat' => 'post_actions'];
161 | $permissions['u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}'] = ['lang' => 'ACL_U_NEW_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}', 'cat' => 'post'];
162 |
163 | $event['permissions'] = $permissions;
164 | }
165 | {% endif %}
166 | }
167 |
--------------------------------------------------------------------------------
/skeleton/ext.php.twig:
--------------------------------------------------------------------------------
1 | container->get('notification_manager')
36 | ->enable_notifications('{{ EXTENSION.vendor_name }}.{{ EXTENSION.extension_name }}.notification.type.sample');
37 |
38 | return 'notification';
39 | }
40 |
41 | return parent::enable_step($old_state);
42 | }
43 |
44 | /**
45 | * Disable notifications for the extension
46 | *
47 | * @param mixed $old_state The return value of the previous call
48 | * of this method, or false on the first call
49 | * @return mixed Returns false after last step, otherwise
50 | * temporary state which is passed as an
51 | * argument to the next step
52 | */
53 | public function disable_step($old_state)
54 | {
55 | if ($old_state === false)
56 | {
57 | $this->container->get('notification_manager')
58 | ->disable_notifications('{{ EXTENSION.vendor_name }}.{{ EXTENSION.extension_name }}.notification.type.sample');
59 |
60 | return 'notification';
61 | }
62 |
63 | return parent::disable_step($old_state);
64 | }
65 |
66 | /**
67 | * Purge notifications for the extension
68 | *
69 | * @param mixed $old_state The return value of the previous call
70 | * of this method, or false on the first call
71 | * @return mixed Returns false after last step, otherwise
72 | * temporary state which is passed as an
73 | * argument to the next step
74 | */
75 | public function purge_step($old_state)
76 | {
77 | if ($old_state === false)
78 | {
79 | $this->container->get('notification_manager')
80 | ->purge_notifications('{{ EXTENSION.vendor_name }}.{{ EXTENSION.extension_name }}.notification.type.sample');
81 |
82 | return 'notification';
83 | }
84 |
85 | return parent::purge_step($old_state);
86 | }
87 | {% endif %}
88 | }
89 |
--------------------------------------------------------------------------------
/skeleton/language/en/cli.php.twig:
--------------------------------------------------------------------------------
1 | '{{ EXTENSION.extension_display_name|e }} console command',
39 | 'CLI_{{ EXTENSION.extension_name|upper }}_HELLO' => 'Hello user',
40 | ]);
41 |
--------------------------------------------------------------------------------
/skeleton/language/en/common.php.twig:
--------------------------------------------------------------------------------
1 | 'Hello %s!',
41 | '{{ EXTENSION.extension_name|upper }}_GOODBYE' => 'Goodbye %s!',
42 |
43 | {% endif %}
44 | {% if COMPONENT.phplistener %}
45 | '{{ EXTENSION.extension_name|upper }}_EVENT' => ' :: {{ EXTENSION.extension_name|capitalize }} Event :: ',
46 |
47 | {% endif %}
48 | {% if COMPONENT.acp %}
49 | 'ACP_{{ EXTENSION.extension_name|upper }}_GOODBYE' => 'Should say goodbye?',
50 | 'ACP_{{ EXTENSION.extension_name|upper }}_SETTING_SAVED' => 'Settings have been saved successfully!',
51 |
52 | {% endif %}
53 | {% if COMPONENT.notification %}
54 | '{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}_NOTIFICATION' => '{{ EXTENSION.extension_display_name|e }} notification',
55 |
56 | {% endif %}
57 | {% if COMPONENT.controller %}
58 | '{{ EXTENSION.extension_name|upper }}_PAGE' => '{{ EXTENSION.extension_name|capitalize }} Page',
59 | 'VIEWING_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}' => 'Viewing {{ EXTENSION.extension_display_name|e }} page',
60 |
61 | {% endif %}
62 | ]);
63 |
--------------------------------------------------------------------------------
/skeleton/language/en/info_acp_demo.php.twig:
--------------------------------------------------------------------------------
1 | '{{ EXTENSION.extension_display_name|e }} Module',
39 | 'ACP_{{ EXTENSION.extension_name|upper }}' => '{{ EXTENSION.extension_display_name|e }} Settings',
40 |
41 | 'LOG_ACP_{{ EXTENSION.extension_name|upper }}_SETTINGS' => '{{ EXTENSION.extension_display_name|e }} settings updated',
42 | ]);
43 |
--------------------------------------------------------------------------------
/skeleton/language/en/info_mcp_demo.php.twig:
--------------------------------------------------------------------------------
1 | 'Front',
39 | 'MCP_{{ EXTENSION.extension_name|upper }}_TITLE' => '{{ EXTENSION.extension_display_name|e }} Module',
40 | ]);
41 |
--------------------------------------------------------------------------------
/skeleton/language/en/info_ucp_demo.php.twig:
--------------------------------------------------------------------------------
1 | 'Settings',
40 | 'UCP_{{ EXTENSION.extension_name|upper }}_TITLE' => '{{ EXTENSION.extension_display_name|e }} Module',
41 | 'UCP_{{ EXTENSION.extension_name|upper }}_USER' => '{{ EXTENSION.extension_display_name|e }} user',
42 | 'UCP_{{ EXTENSION.extension_name|upper }}_USER_EXPLAIN' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
43 | 'UCP_{{ EXTENSION.extension_name|upper }}_SAVED' => 'Settings have been saved successfully!',
44 | {% endif %}
45 | {% if COMPONENT.notification %}
46 | 'NOTIFICATION_TYPE_{{ EXTENSION.extension_name|upper }}' => 'Use {{ EXTENSION.extension_display_name|e }} notifications',
47 | {% endif %}
48 | ]);
49 |
--------------------------------------------------------------------------------
/skeleton/language/en/permissions_demo.php.twig:
--------------------------------------------------------------------------------
1 | 'Can use this {{ EXTENSION.extension_display_name|e }} admin feature',
50 | 'ACL_M_NEW_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}' => 'Can use this {{ EXTENSION.extension_display_name|e }} moderator feature',
51 | 'ACL_U_NEW_{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}' => 'Can use this {{ EXTENSION.extension_display_name|e }} user feature',
52 | ]);
53 |
--------------------------------------------------------------------------------
/skeleton/license.txt.twig:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 |
--------------------------------------------------------------------------------
/skeleton/mcp/main_info.php.twig:
--------------------------------------------------------------------------------
1 | '\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\mcp\main_module',
22 | 'title' => 'MCP_{{ EXTENSION.extension_name|upper }}_TITLE',
23 | 'modes' => [
24 | 'front' => [
25 | 'title' => 'MCP_{{ EXTENSION.extension_name|upper }}',
26 | 'auth' => 'ext_{{ EXTENSION.vendor_name }}/{{ EXTENSION.extension_name }}{% if COMPONENT.permissions %} && acl_m_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}{% endif %}',
27 | 'cat' => ['MCP_{{ EXTENSION.extension_name|upper }}_TITLE'],
28 | ],
29 | ],
30 | ];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/skeleton/mcp/main_module.php.twig:
--------------------------------------------------------------------------------
1 | get('{{ EXTENSION.vendor_name }}.{{ EXTENSION.extension_name }}.controller.mcp');
35 |
36 | // Load a template for our MCP page
37 | $this->tpl_name = 'mcp_{{ EXTENSION.extension_name|lower }}_body';
38 |
39 | // Set the page title for our MCP page
40 | $this->page_title = 'MCP_{{ EXTENSION.extension_name|upper }}_TITLE';
41 |
42 | // Make the $u_action url available in our MCP controller
43 | $mcp_controller->set_page_url($this->u_action);
44 |
45 | // Load the display options handle in our MCP controller
46 | $mcp_controller->display_options();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/skeleton/migrations/install_acp_module.php.twig:
--------------------------------------------------------------------------------
1 | config['{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye']);
18 | }
19 |
20 | public static function depends_on()
21 | {
22 | return ['\phpbb\db\migration\data\{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "3.2", "<") %}v31x\v314{% else %}v320\v320{% endif %}'];
23 | }
24 |
25 | public function update_data()
26 | {
27 | return [
28 | ['config.add', ['{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_goodbye', 0]],
29 |
30 | ['module.add', [
31 | 'acp',
32 | 'ACP_CAT_DOT_MODS',
33 | 'ACP_{{ EXTENSION.extension_name|upper }}_TITLE'
34 | ]],
35 | ['module.add', [
36 | 'acp',
37 | 'ACP_{{ EXTENSION.extension_name|upper }}_TITLE',
38 | [
39 | 'module_basename' => '\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\acp\main_module',
40 | 'modes' => ['settings'],
41 | ],
42 | ]],
43 | ];
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/skeleton/migrations/install_cron.php.twig:
--------------------------------------------------------------------------------
1 | config['{{ EXTENSION.extension_name|lower }}_cron_last_run']);
18 | }
19 |
20 | public static function depends_on()
21 | {
22 | return ['\phpbb\db\migration\data\{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "3.2", "<") %}v31x\v314{% else %}v320\v320{% endif %}'];
23 | }
24 |
25 | public function update_data()
26 | {
27 | return [
28 | ['config.add', ['{{ EXTENSION.extension_name|lower }}_cron_last_run', 0, true]],
29 | ];
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/skeleton/migrations/install_mcp_module.php.twig:
--------------------------------------------------------------------------------
1 | table_prefix . "modules
19 | WHERE module_class = 'mcp'
20 | AND module_langname = 'MCP_{{ EXTENSION.extension_name|upper }}_TITLE'";
21 | $result = $this->db->sql_query($sql);
22 | $module_id = $this->db->sql_fetchfield('module_id');
23 | $this->db->sql_freeresult($result);
24 |
25 | return $module_id !== false;
26 | }
27 |
28 | public static function depends_on()
29 | {
30 | return ['\phpbb\db\migration\data\{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "3.2", "<") %}v31x\v314{% else %}v320\v320{% endif %}'];
31 | }
32 |
33 | public function update_data()
34 | {
35 | return [
36 | ['module.add', [
37 | 'mcp',
38 | 0,
39 | 'MCP_{{ EXTENSION.extension_name|upper }}_TITLE'
40 | ]],
41 | ['module.add', [
42 | 'mcp',
43 | 'MCP_{{ EXTENSION.extension_name|upper }}_TITLE',
44 | [
45 | 'module_basename' => '\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\mcp\main_module',
46 | 'modes' => ['front'],
47 | ],
48 | ]],
49 | ];
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/skeleton/migrations/install_sample_data.php.twig:
--------------------------------------------------------------------------------
1 | config->offsetExists('{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_sample_int');
19 | }
20 |
21 | {% endif %}
22 | public static function depends_on()
23 | {
24 | return ['\phpbb\db\migration\data\{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "3.2", "<") %}v31x\v314{% else %}v320\v320{% endif %}'];
25 | }
26 |
27 | /**
28 | * Add, update or delete data stored in the database during extension installation.
29 | *
30 | {% if COMPONENT.migration %}
31 | * config.add: Add config data.
32 | * config.update: Update config data.
33 | * config.remove: Remove config.
34 | * config_text.add: Add config_text data.
35 | * config_text.update: Update config_text data.
36 | * config_text.remove: Remove config_text.
37 | * module.add: Add a new CP module.
38 | * module.remove: Remove a CP module.
39 | {% endif %}
40 | * permission.add: Add a new permission.
41 | * permission.remove: Remove a permission.
42 | * permission.role_add: Add a new permission role.
43 | * permission.role_update: Update a permission role.
44 | * permission.role_remove: Remove a permission role.
45 | * permission.permission_set: Set a permission to Yes or Never.
46 | * permission.permission_unset: Set a permission to No.
47 | {% if COMPONENT.migration %}
48 | * custom: Run a callable function to perform more complex operations.
49 | {% endif %}
50 | *
51 | * @return array Array of data update instructions
52 | */
53 | public function update_data()
54 | {
55 | return [
56 | {% if COMPONENT.migration %}
57 | // Add new config table settings
58 | ['config.add', ['{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_sample_int', 0]],
59 | ['config.add', ['{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_sample_str', '']],
60 |
61 | // Add a new config_text table setting
62 | ['config_text.add', ['{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_sample', '']],
63 |
64 | {% endif %}
65 | // Add new permissions
66 | ['permission.add', ['a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // New admin permission
67 | ['permission.add', ['m_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // New moderator permission
68 | ['permission.add', ['u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // New user permission
69 |
70 | // ['permission.add', ['a_copy', true, 'a_existing']], // New admin permission a_copy, copies permission settings from a_existing
71 |
72 | // Set our new permissions
73 | ['permission.permission_set', ['ROLE_ADMIN_FULL', 'a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // Give ROLE_ADMIN_FULL a_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} permission
74 | ['permission.permission_set', ['ROLE_MOD_FULL', 'm_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // Give ROLE_MOD_FULL m_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} permission
75 | ['permission.permission_set', ['ROLE_USER_FULL', 'u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // Give ROLE_USER_FULL u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} permission
76 | ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}']], // Give ROLE_USER_STANDARD u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} permission
77 | ['permission.permission_set', ['REGISTERED', 'u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}', 'group']], // Give REGISTERED group u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} permission
78 | ['permission.permission_set', ['REGISTERED_COPPA', 'u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}', 'group', false]], // Set u_new_{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }} to never for REGISTERED_COPPA
79 |
80 | // Add new permission roles
81 | ['permission.role_add', ['{{ EXTENSION.extension_name }} admin role', 'a_', 'a new role for admins']], // New role "{{ EXTENSION.extension_name }} admin role"
82 | ['permission.role_add', ['{{ EXTENSION.extension_name }} moderator role', 'm_', 'a new role for moderators']], // New role "{{ EXTENSION.extension_name }} moderator role"
83 | ['permission.role_add', ['{{ EXTENSION.extension_name }} user role', 'u_', 'a new role for users']], // New role "{{ EXTENSION.extension_name }} user role"
84 | {% if COMPONENT.migration %}
85 |
86 | // Call a custom callable function to perform more complex operations.
87 | ['custom', [[$this, 'sample_callable_install']]],
88 | {% endif %}
89 | ];
90 | }
91 | {% if COMPONENT.migration %}
92 |
93 | /**
94 | * Add, update or delete data stored in the database during extension un-installation (purge step).
95 | *
96 | * IMPORTANT: Under normal circumstances, the changes performed in update_data will
97 | * automatically be reverted during un-installation. This revert_data method is optional
98 | * and only needs to be used to perform custom un-installation changes, such as to revert
99 | * changes made by custom functions called in update_data.
100 | *
101 | * config.add: Add config data.
102 | * config.update: Update config data.
103 | * config.remove: Remove config.
104 | * config_text.add: Add config_text data.
105 | * config_text.update: Update config_text data.
106 | * config_text.remove: Remove config_text.
107 | * module.add: Add a new CP module.
108 | * module.remove: Remove a CP module.
109 | * permission.add: Add a new permission.
110 | * permission.remove: Remove a permission.
111 | * permission.role_add: Add a new permission role.
112 | * permission.role_update: Update a permission role.
113 | * permission.role_remove: Remove a permission role.
114 | * permission.permission_set: Set a permission to Yes or Never.
115 | * permission.permission_unset: Set a permission to No.
116 | * custom: Run a callable function to perform more complex operations.
117 | *
118 | * @return array Array of data update instructions
119 | */
120 | public function revert_data()
121 | {
122 | return [
123 | ['custom', [[$this, 'sample_callable_uninstall']]],
124 | ];
125 | }
126 |
127 | /**
128 | * A custom function for making more complex database changes
129 | * during extension installation. Must be declared as public.
130 | */
131 | public function sample_callable_install()
132 | {
133 | // Run some SQL queries on the database
134 | }
135 |
136 | /**
137 | * A custom function for making more complex database changes
138 | * during extension un-installation. Must be declared as public.
139 | */
140 | public function sample_callable_uninstall()
141 | {
142 | // Run some SQL queries on the database
143 | }
144 | {% endif %}
145 | }
146 |
--------------------------------------------------------------------------------
/skeleton/migrations/install_sample_schema.php.twig:
--------------------------------------------------------------------------------
1 | db_tools->sql_column_exists($this->table_prefix . 'users', 'user_{{ EXTENSION.extension_name|lower }}');
18 | }
19 |
20 | public static function depends_on()
21 | {
22 | return ['\phpbb\db\migration\data\{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_min, "3.2", "<") %}v31x\v314{% else %}v320\v320{% endif %}'];
23 | }
24 |
25 | /**
26 | * Update database schema.
27 | *
28 | * add_tables: Add tables
29 | * drop_tables: Drop tables
30 | * add_columns: Add columns to a table
31 | * drop_columns: Removing/Dropping columns
32 | * change_columns: Column changes (only type, not name)
33 | * add_primary_keys: adding primary keys
34 | * add_unique_index: adding an unique index
35 | * add_index: adding an index (can be column:index_size if you need to provide size)
36 | * drop_keys: Dropping keys
37 | *
38 | * This sample migration adds a new column to the users table.
39 | {% if COMPONENT.migration %}
40 | * It also adds an example of a new table that can hold new data.
41 | {% endif %}
42 | *
43 | * @return array Array of schema changes
44 | */
45 | public function update_schema()
46 | {
47 | return [
48 | {% if COMPONENT.migration %}
49 | 'add_tables' => [
50 | $this->table_prefix . '{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_table' => [
51 | 'COLUMNS' => [
52 | '{{ EXTENSION.extension_name|lower }}_id' => ['UINT', null, 'auto_increment'],
53 | '{{ EXTENSION.extension_name|lower }}_name' => ['VCHAR:255', ''],
54 | ],
55 | 'PRIMARY_KEY' => '{{ EXTENSION.extension_name|lower }}_id',
56 | ],
57 | ],
58 | {% endif %}
59 | 'add_columns' => [
60 | $this->table_prefix . 'users' => [
61 | 'user_{{ EXTENSION.extension_name|lower }}' => ['UINT', 0],
62 | ],
63 | ],
64 | ];
65 | }
66 |
67 | /**
68 | * Revert database schema changes. This method is almost always required
69 | * to revert the changes made above by update_schema.
70 | *
71 | * add_tables: Add tables
72 | * drop_tables: Drop tables
73 | * add_columns: Add columns to a table
74 | * drop_columns: Removing/Dropping columns
75 | * change_columns: Column changes (only type, not name)
76 | * add_primary_keys: adding primary keys
77 | * add_unique_index: adding an unique index
78 | * add_index: adding an index (can be column:index_size if you need to provide size)
79 | * drop_keys: Dropping keys
80 | *
81 | * This sample migration removes the column that was added the users table in update_schema.
82 | {% if COMPONENT.migration %}
83 | * It also removes the table that was added in update_schema.
84 | {% endif %}
85 | *
86 | * @return array Array of schema changes
87 | */
88 | public function revert_schema()
89 | {
90 | return [
91 | 'drop_columns' => [
92 | $this->table_prefix . 'users' => [
93 | 'user_{{ EXTENSION.extension_name|lower }}',
94 | ],
95 | ],
96 | {% if COMPONENT.migration %}
97 | 'drop_tables' => [
98 | $this->table_prefix . '{{ EXTENSION.vendor_name|lower }}_{{ EXTENSION.extension_name|lower }}_table',
99 | ],
100 | {% endif %}
101 | ];
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/skeleton/migrations/install_ucp_module.php.twig:
--------------------------------------------------------------------------------
1 | table_prefix . "modules
19 | WHERE module_class = 'ucp'
20 | AND module_langname = 'UCP_{{ EXTENSION.extension_name|upper }}_TITLE'";
21 | $result = $this->db->sql_query($sql);
22 | $module_id = $this->db->sql_fetchfield('module_id');
23 | $this->db->sql_freeresult($result);
24 |
25 | return $module_id !== false;
26 | }
27 |
28 | public static function depends_on()
29 | {
30 | return ['\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\migrations\install_sample_schema'];
31 | }
32 |
33 | public function update_data()
34 | {
35 | return [
36 | ['module.add', [
37 | 'ucp',
38 | 0,
39 | 'UCP_{{ EXTENSION.extension_name|upper }}_TITLE'
40 | ]],
41 | ['module.add', [
42 | 'ucp',
43 | 'UCP_{{ EXTENSION.extension_name|upper }}_TITLE',
44 | [
45 | 'module_basename' => '\{{ EXTENSION.vendor_name }}\{{ EXTENSION.extension_name }}\ucp\main_module',
46 | 'modes' => ['settings'],
47 | ],
48 | ]],
49 | ];
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/skeleton/notification/type/sample.php.twig:
--------------------------------------------------------------------------------
1 | {% set is_phpbb_pre_32 = skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.2", "<") %}
2 | helper = $helper;
32 | }
33 |
34 | /**
35 | * Get notification type name
36 | *
37 | * @return string
38 | */
39 | public function get_type()
40 | {
41 | return '{{ EXTENSION.vendor_name }}.{{ EXTENSION.extension_name }}.notification.type.sample';
42 | }
43 |
44 | /**
45 | * Notification option data (for outputting to the user)
46 | *
47 | * @var bool|array False if the service should use it's default data
48 | * Array of data (including keys 'id', 'lang', and 'group')
49 | */
50 | public static $notification_option = [
51 | 'lang' => 'NOTIFICATION_TYPE_{{ EXTENSION.extension_name|upper }}',
52 | ];
53 |
54 | /**
55 | * Is this type available to the current user (defines whether or not it will be shown in the UCP Edit notification options)
56 | *
57 | * @return bool True/False whether or not this is available to the user
58 | */
59 | public function is_available()
60 | {
61 | return false;
62 | }
63 |
64 | /**
65 | * Get the id of the notification
66 | *
67 | * @param array $data The type specific data
68 | *
69 | * @return int Id of the notification
70 | */
71 | public static function get_item_id($data)
72 | {
73 | return $data['notification_id'];
74 | }
75 |
76 | /**
77 | * Get the id of the parent
78 | *
79 | * @param array $data The type specific data
80 | *
81 | * @return int Id of the parent
82 | */
83 | public static function get_item_parent_id($data)
84 | {
85 | // No parent
86 | return 0;
87 | }
88 |
89 | /**
90 | * Find the users who want to receive notifications
91 | *
92 | * @param array $data The type specific data
93 | * @param array $options Options for finding users for notification
94 | * ignore_users => array of users and user types that should not receive notifications from this type because they've already been notified
95 | * e.g.: [2 => [''], 3 => ['', 'email'], ...]
96 | *
97 | * @return array
98 | */
99 | public function find_users_for_notification($data, $options = [])
100 | {
101 | // Return an array of users to be notified, storing the user_ids as the array keys
102 | return [];
103 | }
104 |
105 | /**
106 | * Users needed to query before this notification can be displayed
107 | *
108 | * @return array Array of user_ids
109 | */
110 | public function users_to_query()
111 | {
112 | return [];
113 | }
114 |
115 | /**
116 | * Get the HTML formatted title of this notification
117 | *
118 | * @return string
119 | */
120 | public function get_title()
121 | {
122 | return $this->{{ LANGUAGE.object }}->lang('{{ EXTENSION.vendor_name|upper }}_{{ EXTENSION.extension_name|upper }}_NOTIFICATION');
123 | }
124 |
125 | /**
126 | * Get the url to this item
127 | *
128 | * @return string URL
129 | */
130 | public function get_url()
131 | {
132 | return $this->helper->route('{{ EXTENSION.vendor_name }}_{{ EXTENSION.extension_name }}_controller', $this->get_data('{{ EXTENSION.extension_name|lower }}_sample_name'));
133 | }
134 |
135 | /**
136 | * Get email template
137 | *
138 | * @return string|bool
139 | */
140 | public function get_email_template()
141 | {
142 | return false;
143 | }
144 |
145 | /**
146 | * Get email template variables
147 | *
148 | * @return array
149 | */
150 | public function get_email_template_variables()
151 | {
152 | return [];
153 | }
154 |
155 | /**
156 | * Function for preparing the data for insertion in an SQL query
157 | * (The service handles insertion)
158 | *
159 | * @param array $data The type specific data
160 | * @param array $pre_create_data Data from pre_create_insert_array()
161 | {% if is_phpbb_pre_32 %}{# for phpBB 3.1.x only #}
162 | *
163 | * @return array Array of data ready to be inserted into the database
164 | {% endif %}{# for phpBB >= 3.2.x #}
165 | */
166 | public function create_insert_array($data, $pre_create_data = [])
167 | {
168 | $this->set_data('{{ EXTENSION.extension_name|lower }}_sample_name', $data['{{ EXTENSION.extension_name|lower }}_sample_name']);
169 |
170 | {% if is_phpbb_pre_32 %}{# for phpBB 3.1.x only #}
171 | return parent::create_insert_array($data, $pre_create_data);
172 | {% else %}{# for phpBB >= 3.2.x #}
173 | parent::create_insert_array($data, $pre_create_data);
174 | {% endif %}
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/skeleton/phpunit.xml.dist.twig:
--------------------------------------------------------------------------------
1 | {% set is_phpbb_pre_33 = skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.3", "<") %}
2 |
3 |
4 |
18 |
19 |
20 | ./tests
21 | ./tests/functional
22 |
23 |
24 | ./tests/functional/
25 |
26 |
27 |
28 |
29 | {% if is_phpbb_pre_33 %}
30 |
31 | ./tests/
32 |
33 | {% endif %}
34 |
35 | ./
36 |
37 | ./language/
38 | ./migrations/
39 | ./tests/
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/skeleton/service.php.twig:
--------------------------------------------------------------------------------
1 | user = $user;
33 | $this->table_name = $table_name;
34 | }
35 |
36 | /**
37 | * Get user object
38 | *
39 | * @return \phpbb\user $user User object
40 | */
41 | public function get_user()
42 | {
43 | var_dump($this->table_name);
44 | return $this->user;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/skeleton/styles/prosilver/template/demo_body.html.twig:
--------------------------------------------------------------------------------
1 | {{ '{' }}% include 'overall_header.html' %}
2 |
3 |