pfeifferNet

Settings_Export extends Settings_Import_Export
in package

Functionality to export site settings as a json file.

  • Add tab and form to pNet tools page.
  • Handle AJAX interaction.
Tags
since
5.8.0
since
5.11.0

Deprecated global singleton.

since
6.0.0

Use class-settings export method.

uses
Settings_Import_Export

Table of Contents

Constants

ACTION  = 'pnet_export_settings'
The wp_ajax hook action properties.
CAPABILITY  = 'edit_others_posts'
The user capability required to run this tool.
FORM_NAME  = 'export_settings'
The name attribute of the form.
HANDLER  = 'downloadSettings'
The name of the javascript handler for the form.
NONCE_NAME  = 'token'
The nonce name for the form.
TARGET_TAB  = 'transfer'
Target tools page tab for this tool.
TOOL_CONTAINER  = 'form-settings-export.php'
Tool container partial.

Properties

$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.
$options_handler  : Settings
The instance of the Settings class.
$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_tab()  : array<string|int, mixed>
Create the target tab on the tools page if it doesn't exist.
__construct()  : void
Initialise the class.
get_tab_name()  : string
Return the tab name.
init_tool()  : void
Initialise the tool form with required values and assets.

Constants

ACTION

The wp_ajax hook action properties.

protected string ACTION = 'pnet_export_settings'
Tags
since
5.8.0

CAPABILITY

The user capability required to run this tool.

protected string CAPABILITY = 'edit_others_posts'
Tags
since
5.10.0

FORM_NAME

The name attribute of the form.

protected string FORM_NAME = 'export_settings'
Tags
since
6.0.0

HANDLER

The name of the javascript handler for the form.

protected string HANDLER = 'downloadSettings'
Tags
since
6.0.0

NONCE_NAME

The nonce name for the form.

protected string NONCE_NAME = 'token'
Tags
since
6.1.0

TARGET_TAB

Target tools page tab for this tool.

protected string TARGET_TAB = 'transfer'
  • This will be created if it doesn't exist.
Tags
since
6.0.0

TOOL_CONTAINER

Tool container partial.

protected string TOOL_CONTAINER = 'form-settings-export.php'
Tags
since
5.8.0

Properties

$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
since
6.1.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
6.1.0

$tool_container

Fully qualified path to the tool container partial.

protected string $tool_container = ''
Tags
since
6.1.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
6.1.0
Return values
object

The instance of this class.

handle_ajax_request()

The AJAX call handler.

public handle_ajax_request() : void
Tags
since
5.8.0
since
6.0.0

Use settings get_export method.

uses
Options_Handler::get_export()

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
since
6.1.0
see
Tools::render()

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
since
6.1.0
see
Tools::render()
Return values
array<string|int, mixed>

The (maybe) modified tabs array.

get_tab_name()

Return the tab name.

protected get_tab_name() : string
Tags
since
6.1.0
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
since
6.1.0

        
On this page

Search results