ExportWCSettingsAccount
extends ExportWCSettings
in package
Uses
UseWPFunctions
Class ExportWCSettingsAccount
This class exports WooCommerce settings on the Account and Privacy page.
Table of Contents
- $filesystem_initialized : bool
- Whether the filesystem has been initialized.
- check_step_capabilities() : bool
- Check if the current user has the required capabilities for this step.
- export() : SetSiteOptions
- Export WooCommerce settings.
- get_alias() : string
- Get the alias for this exporter.
- get_description() : string
- Return description used in the frontend.
- get_label() : string
- Return label used in the frontend.
- get_step_name() : string
- Get the name of the step.
- is_wp_error() : bool
- Checks if a variable is a WP_Error.
- wp_activate_plugin() : WP_Error|null
- Activates a plugin.
- wp_add_action() : mixed
- Adds an action to a specified tag.
- wp_add_filter() : mixed
- Adds a filter to a specified tag.
- wp_apply_filters() : mixed
- Calls the functions added to a filter hook.
- wp_delete_plugins() : array<string|int, mixed>|WP_Error|null
- Deletes plugins.
- wp_do_action() : mixed
- Executes the functions hooked on a specific action hook.
- wp_download_url() : string|WP_Error
- Downloads a file from a URL.
- wp_filesystem_get_contents() : string|false
- Alias for WP_Filesystem::get_contents().
- wp_filesystem_put_contents() : bool
- Alias for WP_Filesystem::put_contents().
- wp_get_current_user_id() : int
- Retrieves the current user's ID.
- wp_get_option() : mixed
- Retrieves an option from the database.
- wp_get_plugins() : array<string|int, mixed>
- Retrieves all plugins.
- wp_get_theme() : WP_Theme
- Retrieves a theme.
- wp_get_theme_root() : string
- Retrieves the root directory of the current theme.
- wp_get_themes() : array<string|int, mixed>
- Retrieves all themes.
- wp_init_filesystem() : bool
- Initializes the WordPress filesystem.
- wp_is_plugin_active() : bool
- Checks if a plugin is active.
- wp_plugins_api() : object|WP_Error
- Retrieves plugin information from the WordPress Plugin API.
- wp_switch_theme() : mixed
- Switches the current theme.
- wp_themes_api() : object|WP_Error
- Retrieves theme information from the WordPress Theme API.
- wp_unzip_file() : bool|WP_Error
- Unzips a file to a specified location.
- wp_update_option() : bool
- Updates an option in the database.
- wp_upload_dir() : array<string|int, mixed>
- Retrieves the upload directory information.
- get_page_id() : string
- Get the page ID for the settings page.
Properties
$filesystem_initialized
Whether the filesystem has been initialized.
private
bool
$filesystem_initialized
= false
Methods
check_step_capabilities()
Check if the current user has the required capabilities for this step.
public
check_step_capabilities() : bool
Return values
bool — True if the user has the required capabilities. False otherwise.export()
Export WooCommerce settings.
public
export() : SetSiteOptions
Return values
SetSiteOptions —get_alias()
Get the alias for this exporter.
public
get_alias() : string
Return values
string —get_description()
Return description used in the frontend.
public
get_description() : string
Return values
string —get_label()
Return label used in the frontend.
public
get_label() : string
Return values
string —get_step_name()
Get the name of the step.
public
get_step_name() : string
Return values
string —is_wp_error()
Checks if a variable is a WP_Error.
public
is_wp_error(mixed $thing) : bool
Parameters
- $thing : mixed
-
Variable to check.
Return values
bool — True if the variable is a WP_Error, false otherwise.wp_activate_plugin()
Activates a plugin.
public
wp_activate_plugin(string $plugin[, string $redirect = '' ][, bool $network_wide = false ][, bool $silent = false ]) : WP_Error|null
Parameters
- $plugin : string
-
Path to the plugin file relative to the plugins directory.
- $redirect : string = ''
-
Optional. URL to redirect to after activation.
- $network_wide : bool = false
-
Optional. Whether to enable the plugin for all sites in the network.
- $silent : bool = false
-
Optional. Whether to prevent calling activation hooks.
Return values
WP_Error|null — WP_Error on failure, null on success.wp_add_action()
Adds an action to a specified tag.
public
wp_add_action(string $tag, callable $function_to_add[, int $priority = 10 ][, int $accepted_args = 1 ]) : mixed
Parameters
- $tag : string
-
The name of the action to hook the $function_to_add to.
- $function_to_add : callable
-
The callback to be run when the action is triggered.
- $priority : int = 10
-
Optional. Used to specify the order in which the functions associated with a particular action are executed. Default 10.
- $accepted_args : int = 1
-
Optional. The number of arguments the function accepts. Default 1.
Return values
mixed —wp_add_filter()
Adds a filter to a specified tag.
public
wp_add_filter(string $tag, callable $function_to_add[, int $priority = 10 ][, int $accepted_args = 1 ]) : mixed
Parameters
- $tag : string
-
The name of the filter to hook the $function_to_add to.
- $function_to_add : callable
-
The callback to be run when the filter is applied.
- $priority : int = 10
-
Optional. Used to specify the order in which the functions associated with a particular action are executed. Default 10.
- $accepted_args : int = 1
-
Optional. The number of arguments the function accepts. Default 1.
Return values
mixed —wp_apply_filters()
Calls the functions added to a filter hook.
public
wp_apply_filters(string $tag, mixed $value) : mixed
Parameters
- $tag : string
-
The name of the filter hook.
- $value : mixed
-
The value on which the filters hooked to $tag are applied on.
Return values
mixed — The filtered value after all hooked functions are applied to it.wp_delete_plugins()
Deletes plugins.
public
wp_delete_plugins(array<string|int, mixed> $plugins) : array<string|int, mixed>|WP_Error|null
Parameters
- $plugins : array<string|int, mixed>
-
List of plugins to delete.
Return values
array<string|int, mixed>|WP_Error|null — Array of results or WP_Error on failure, null if filesystem credentials are required to proceed.wp_do_action()
Executes the functions hooked on a specific action hook.
public
wp_do_action(string $tag, mixed ...$args) : mixed
Parameters
- $tag : string
-
The name of the action to be executed.
- $args : mixed
-
Optional. Additional arguments which are passed on to the functions hooked to the action.
Return values
mixed —wp_download_url()
Downloads a file from a URL.
public
wp_download_url(string $url) : string|WP_Error
Parameters
- $url : string
-
The URL of the file to download.
Return values
string|WP_Error — The local file path on success, WP_Error on failure.wp_filesystem_get_contents()
Alias for WP_Filesystem::get_contents().
public
wp_filesystem_get_contents(string $file_path) : string|false
Parameters
- $file_path : string
-
The path to the file to read.
Return values
string|false — The contents of the file, or false on failure.wp_filesystem_put_contents()
Alias for WP_Filesystem::put_contents().
public
wp_filesystem_put_contents(string $file_path, mixed $content) : bool
Parameters
- $file_path : string
-
The path to the file to write.
- $content : mixed
-
The data to write to the file.
Return values
bool — True on success, false on failure.wp_get_current_user_id()
Retrieves the current user's ID.
public
wp_get_current_user_id() : int
Return values
int — The current user's ID.wp_get_option()
Retrieves an option from the database.
public
wp_get_option(string $option[, mixed $default_value = false ]) : mixed
Parameters
- $option : string
-
Name of the option to retrieve.
- $default_value : mixed = false
-
Optional. Default value to return if the option does not exist.
Return values
mixed — Value of the option or $default if the option does not exist.wp_get_plugins()
Retrieves all plugins.
public
wp_get_plugins([string $plugin_folder = '' ]) : array<string|int, mixed>
Parameters
- $plugin_folder : string = ''
-
Optional. Path to the plugin folder to scan.
Return values
array<string|int, mixed> — Array of plugins.wp_get_theme()
Retrieves a theme.
public
wp_get_theme([string|null $stylesheet = null ]) : WP_Theme
Parameters
- $stylesheet : string|null = null
-
Optional. The theme's stylesheet name.
Return values
WP_Theme — The theme object.wp_get_theme_root()
Retrieves the root directory of the current theme.
public
wp_get_theme_root() : string
Return values
string — The root directory of the current theme.wp_get_themes()
Retrieves all themes.
public
wp_get_themes([array<string|int, mixed> $args = array() ]) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed> = array()
-
Optional. Arguments to pass to the API.
Return values
array<string|int, mixed> — Array of themes.wp_init_filesystem()
Initializes the WordPress filesystem.
public
wp_init_filesystem() : bool
Return values
bool —wp_is_plugin_active()
Checks if a plugin is active.
public
wp_is_plugin_active(string $plugin) : bool
Parameters
- $plugin : string
-
Path to the plugin file relative to the plugins directory.
Return values
bool — True if the plugin is active, false otherwise.wp_plugins_api()
Retrieves plugin information from the WordPress Plugin API.
public
wp_plugins_api(string $action[, array<string|int, mixed> $args = array() ]) : object|WP_Error
Parameters
- $action : string
-
The type of information to retrieve from the API.
- $args : array<string|int, mixed> = array()
-
Optional. Arguments to pass to the API.
Return values
object|WP_Error — The API response object or WP_Error on failure.wp_switch_theme()
Switches the current theme.
public
wp_switch_theme(string $name) : mixed
Parameters
- $name : string
-
The name of the theme to switch to.
Return values
mixed —wp_themes_api()
Retrieves theme information from the WordPress Theme API.
public
wp_themes_api(string $action[, array<string|int, mixed> $args = array() ]) : object|WP_Error
Parameters
- $action : string
-
The type of information to retrieve from the API.
- $args : array<string|int, mixed> = array()
-
Optional. Arguments to pass to the API.
Return values
object|WP_Error — The API response object or WP_Error on failure.wp_unzip_file()
Unzips a file to a specified location.
public
wp_unzip_file(string $path, string $to) : bool|WP_Error
Parameters
- $path : string
-
Path to the ZIP file.
- $to : string
-
Destination directory.
Return values
bool|WP_Error — True on success, WP_Error on failure.wp_update_option()
Updates an option in the database.
public
wp_update_option(string $option, mixed $value[, string|null $autoload = null ]) : bool
Parameters
- $option : string
-
Name of the option to update.
- $value : mixed
-
New value for the option.
- $autoload : string|null = null
-
Optional. Whether to load the option when WordPress starts up.
Return values
bool — True if option was updated, false otherwise.wp_upload_dir()
Retrieves the upload directory information.
public
wp_upload_dir() : array<string|int, mixed>
Return values
array<string|int, mixed> — Array of upload directory information.get_page_id()
Get the page ID for the settings page.
protected
get_page_id() : string