Manage_PHP_Log
extends Manage_Log
in package
Manage the system PHP error log.
- Add tab and form to pNet tools page.
- View the log.
- Clear the log - if permissions allow.
- Handle AJAX interaction.
Tags
Table of Contents
Constants
- ACTION = 'pnet_clear_php_log'
- The wp_ajax hook action properties.
- CAPABILITY = 'edit_others_posts'
- The user capability required to view logs.
- CLEAR_CAPABILITY = 'manage_options'
- The user capability required to clear logs.
- FORM_NAME = 'view_log'
- The name attribute of the form.
- HANDLER = 'clearLog'
- The name of the javascript handler for the form.
- NONCE_NAME = 'token'
- The nonce name for the form.
- TARGET_TAB = 'php_log'
- Target tools page tab for this tool.
- TOOL_CONTAINER = 'form-manage-log.php'
- Tool container partial.
Properties
- $can_clear : bool
- The can clear log flag.
- $form_vars : array<string|int, mixed>
- The variables used to render the form.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $log_file : string
- Fully qualified path to the log file.
- $tool_container : string
- Fully qualified path to the tool container partial.
Methods
- get_action() : string
- Return the action name.
- get_instance() : object
- Creates and/or returns the instance of this class.
- handle_ajax_request() : void
- The AJAX call handler.
- render() : void
- Render the tool.
- set_script_vars() : array<string|int, mixed>
- Filter the array of tools javascript values.
- set_tab() : array<string|int, mixed>
- Create the target tab on the tools page if it doesn't exist.
- __construct() : void
- Initialise the class.
- get_entries() : array<string|int, mixed>
- Get entries from log file.
- get_tab_name() : string
- Return the tab name.
- init_tool() : void
- Initialise the tool form with required values and assets.
- set_file_path() : void
- Set log file fully qualifed path.
Constants
ACTION
The wp_ajax hook action properties.
protected
string
ACTION
= 'pnet_clear_php_log'
Tags
CAPABILITY
The user capability required to view logs.
protected
string
CAPABILITY
= 'edit_others_posts'
Tags
CLEAR_CAPABILITY
The user capability required to clear logs.
protected
string
CLEAR_CAPABILITY
= 'manage_options'
Tags
FORM_NAME
The name attribute of the form.
protected
string
FORM_NAME
= 'view_log'
Tags
HANDLER
The name of the javascript handler for the form.
protected
string
HANDLER
= 'clearLog'
Tags
NONCE_NAME
The nonce name for the form.
protected
string
NONCE_NAME
= 'token'
Tags
TARGET_TAB
Target tools page tab for this tool.
protected
string
TARGET_TAB
= 'php_log'
Tags
TOOL_CONTAINER
Tool container partial.
protected
string
TOOL_CONTAINER
= 'form-manage-log.php'
Tags
Properties
$can_clear
The can clear log flag.
protected
bool
$can_clear
= false
Tags
$form_vars
The variables used to render the form.
protected
array<string|int, mixed>
$form_vars
= array('title' => '', 'description' => '')
- Each tool may have its own set of variables other than these.
{ Array of variables used to render the form. @type string $title The title of the form. @type string $description The description for the form. }
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$log_file
Fully qualified path to the log file.
protected
string
$log_file
= ''
Tags
$tool_container
Fully qualified path to the tool container partial.
protected
string
$tool_container
= ''
Tags
Methods
get_action()
Return the action name.
public
get_action() : string
- This is the {action} part of the wp_ajax hook name.
Tags
Return values
string —The action name.
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
handle_ajax_request()
The AJAX call handler.
public
handle_ajax_request() : void
Tags
render()
Render the tool.
public
render([string $tab = '' ]) : void
- The priority set on this hook will determine the tool sequence down the page.
Parameters
- $tab : string = ''
-
The slug of the active tab on tools page.
Tags
set_script_vars()
Filter the array of tools javascript values.
public
set_script_vars([array<string|int, mixed> $script_vars = array() ]) : array<string|int, mixed>
- This is hooked from the pnet_tools_vars filter.
Parameters
- $script_vars : array<string|int, mixed> = array()
-
The existing tools values provided by the filter.
Tags
Return values
array<string|int, mixed> —The modified tools vars.
set_tab()
Create the target tab on the tools page if it doesn't exist.
public
set_tab([array<string|int, mixed> $tabs = array() ]) : array<string|int, mixed>
- The priority set on this hook will determine the tab sequence across the page.
Parameters
- $tabs : array<string|int, mixed> = array()
-
A set of key/value pairs for the admin tools page.
Tags
Return values
array<string|int, mixed> —The (maybe) modified tabs array.
__construct()
Initialise the class.
protected
__construct() : void
Tags
get_entries()
Get entries from log file.
protected
get_entries() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The log entries.
get_tab_name()
Return the tab name.
protected
get_tab_name() : string
Tags
Return values
string —The display name of the tab for this tool.
init_tool()
Initialise the tool form with required values and assets.
protected
init_tool() : void
Tags
set_file_path()
Set log file fully qualifed path.
protected
set_file_path() : void