10quality / wpmvc-addon-status
System status report pages for WordPress MVC framework.
Installs: 2 040
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
Requires
- php: >=5.4.0
- 10quality/wpmvc-addon: 1.0.*
- 10quality/wpmvc-core: >=3.1.0
Requires (Dev)
- 10quality/wpmvc-addon-testsuite: dev-main
- phpunit/phpunit: 9.*
This package is auto-updated.
Last update: 2024-10-11 02:33:01 UTC
README
Add-on for WordPress MVC.
The add-on will add a "System Status" option inside WordPress admin dashboard, allowing for administrator to see the system status and log files.
Features:
- System status (WP, PHP and DB versions).
- Easy JSON export.
- WordPress MVC log file viewer.
- Flush WordPress MVC cache.
Install and Configuration
To install, use the following composer command:
composer require 10quality/wpmvc-addon-status
To configure the add-on, simply add it to your projects add-ons list at [project]/app/Config/app.php
:
'addons' => [ 'WPMVC\Addons\Status\StatusAddon', ],
Hooks
You can add custom status information and sections.
wpmvc_addon_status_sections
Filter wpmvc_addon_status_sections
allows to add new sections to the system status report, example:
add_filter( 'wpmvc_addon_status_sections', function( $sections ) { $sections['my-plugin'] = __( 'My Plugin', 'my-domain' ); return $sections; } );
wpmvc_addon_status_data
Filter wpmvc_addon_status_data
allows to add new date to the system status report, data can be added as:
- Array
- Class instance of
StatusData
.
Using array
Example:
add_filter( 'wpmvc_addon_status_data', function( $data ) { $data[] = [ 'section' => 'my-plugin', 'title' => __( 'API Connection', 'my-domain' ); 'message' => __( 'Yes', 'my-domain' ); 'status' => 1, ]; return $data; } );
Class instance
Example:
namespace MyNamespace\SystemStatus; use WPMVC\Addons\Status\Abstracts\StatusData; /** * Custom system status data. */ class ConnectionData extends StatusData { /** * Checks connection. * This method is always called by the addon to init data. */ public function check() { // Do custom code $has_connection = true; $this->section = 'my-plugin'; $this->title = __( 'API Connection', 'my-domain' ); $this->message = $has_connection ? 'Yes' : 'No'; $this->status = $has_connection ? 1 : 3; } }
Then add class to filter:
add_filter( 'wpmvc_addon_status_data', function( $data ) { $data[] = new ConnectionData(); return $data; } );
Data status
Coding Guidelines
PSR-2 coding guidelines.
License
MIT License. (c) 2020 10 Quality.