Updated Plugin Architecture (markdown)

Ben Goldsworthy 2021-04-25 16:37:58 +01:00
parent fab8d6e007
commit 66c52a0162

@ -9,7 +9,7 @@ It has been initially produced as part of [Issue #87](https://github.com/markche
| `assets/` | Files to be stored in the [`assets/` directory](https://plugins.svn.wordpress.org/footnotes/assets/) on the SVN repo. (e.g., screenshots for the Plugin information page). |
| `docs/` | Automatically-generated documentation files. |
| `src/` | The source code for the Plugin itself. |
| `_tools/` | Useful Bash scripts (NB: This should eventually be merged with `.github/workflows/`) |
| `_tools/` | Useful Bash scripts (@todo this should eventually be merged with `.github/workflows/`). |
| `.github/` | GitHub Actions workflows and Issue templates. |
# Root Files
@ -25,8 +25,54 @@ It has been initially produced as part of [Issue #87](https://github.com/markche
| `README.md` | Provides an overview of the project. |
| `SECURITY.md` | Provides guidance on reporting security-related issues. |
| `wpml-config.xml` | Used by the [WPML Plugin](https://wpml.org/documentation/support/language-configuration-files/) for translation. |
| `.distignore` | Lists files to ignore when building the Plugin for distribution (NB: Not currently used). |
| `.distignore` | Lists files to ignore when building the Plugin for distribution (@todo this is not currently used). |
| `.eslintignore` & `.eslintrc.js` | Config. files for JavaScript linting. |
| `.gitignore` | Lists files to exclude from Git version control. |
| `.prettierignore` & `.prettierrc` | Config. files for JavaScript formatting. |
| `.stylelintignore` & `.stylelinttc.json` | Config. files for stylesheet linting. |
# Plugin Source (`src/`) Layout
## Plugin Source Root Files
| File Name | Description |
|------|-------------|
| `footnotes.php` | The Plugin entry point. |
| `includes.php` | Includes all of the PHP files. |
| `license.txt` | The license under which the Plugin is released. |
| `readme.txt` | The Plugin readme for display on the WordPress Plugin Directory. |
## Plugin Source Root Directories
| File Name | Description |
|------|-------------|
| `class/` | Contains the Plugin PHP code, providing most of its functionality. |
| `css/` | Contains the Plugin stylesheets. |
| `img/` | Contains images used by the Plugin (@todo can this be merged with the root `assets/` dir?). |
| `js/` | Contains JavaScript files used by the Plugin. |
| `languages/` | Contains Plugin translation files for various languages. |
| `templates/` | Contains HTML template files used by the Plugin. |
## `class/` Sub-directory
### `class/` Root Files
Important files are highlighted in **bold** text.
| File Name | Description |
|------|-------------|
| `config.php` | Defines various constants (@todo rename to something more accurate). |
| `convert.php` | Provides various conversion functions. |
| `hooks.php` | Registers actions with various WordPress hooks. |
| **`init.php`** | Defines the Plugin object. |
| `language.php` | Loads translation settings. |
| **`settings.php`** | Defines the various Plugin settings. |
| **`task.php`** | Provides the core function of the Plugin. |
| `templates.php` | Loads the various template files. |
| `wysiwyg.php` | Provides integration with the WordPress WYSIWYG editor. |
### `class/` Sub-directories
| File Name | Description |
|------|-------------|
| `footnotes.php` | The Plugin entry point. |