Properties

$instance

$instance : mixed

Public static variable to hold the single instance of the class.

Type

mixed — Default null

$security_nonces

$security_nonces : array

Protected variable to hold security nonces.

Type

array — Security nonces.

Methods

get_class_name()

get_class_name() : string

Method get_class_name()

Get class name.

Returns

string —

CLASS Class name.

instance()

instance() : mixed

Method instance()

Create a public static instance.

Returns

mixed —

Class instance.

init_ajax()

init_ajax() 

Method init_ajax()

Initiate AJAX requests.

add_security_nonce()

add_security_nonce(string  $action) 

Method add_security_nonce()

Create security nonce for specific actions.

Parameters

string $action

Contains the action that requires security nonce.

get_security_nonces()

get_security_nonces() : array

Method get_security_nonces()

Get security nonces from the security nonces array.

Returns

array —

Security nonces.

add_action()

add_action(string  $action, string  $callback) 

Method add_action()

Add actions to the 'wpajax' hook and create security nonce.

Parameters

string $action

Contains action to be added to the 'wpajax' hook.

string $callback

Contains a callback action.

secure_request()

secure_request(string  $action = '', string  $query_arg = 'security') : void

Method secure_request()

Build secure request for the clone process.

Parameters

string $action

Contains the action that is being performed.

string $query_arg

Contains the query argument.

check_security()

check_security(string  $action = -1, string  $query_arg = 'security') : boolean

Method check_security()

Check the clone request security.

Parameters

string $action

Contains the action that is being performed.

string $query_arg

Contains the query argument.

Returns

boolean —

true|false If secure, return true, if not, return false.

init()

init() 

Method init()

Initiate action hooks.

upload_mimes()

upload_mimes(array  $mime_types = array()) : array

Method upload_mimes()

Add allowed mime types and file extensions.

Parameters

array $mime_types

Mime types keyed by the file extension regex corresponding to those types.

Returns

array —

Array containing allowed mime types.

request_clone_funct()

request_clone_funct() : boolean|void

Request clone.

Returns

boolean|void —

true|void.

clone_backup_create()

clone_backup_create() 

Method clone_backup_create()

Create backup of template site so it can be used to clone it.

Throws

\Exception

Error message.

clone_backup_create_poll()

clone_backup_create_poll() 

Method clone_backup_create_poll()

Create backup poll of template site so it can be used to clone it.

Throws

\Exception

Error message.

clone_backup_download()

clone_backup_download() : mixed

Method clone_backup_download()

Download backup file of template site so it can be used to clone it.

Throws

\Exception

Error message.

Returns

mixed —

Response message.

clone_backup_download_poll()

clone_backup_download_poll() 

Method clone_backup_download_poll()

Download backup file poll of template site so it can be used to clone it.

Throws

\Exception

Error message.

clone_backup_extract()

clone_backup_extract() 

Method clone_backup_extract()

Extract the backup archive to clone the site.

is_archive()

is_archive(string  $file_name, string  $prefix = '', string  $suffix = '') : boolean

Method is_archive()

Check if the file is archive file.

Parameters

string $file_name

Contains the file name.

string $prefix

Contains the prefix.

string $suffix

Contains the sufix.

Returns

boolean —

true|false If the file is archive, return true, if not, return false.

permalink_changed()

permalink_changed(string  $action) 

Method permalink_changed()

Check if the permalinks settings are re-saved.

Parameters

string $action

Contains performed action.

clone_backup_get_file()

clone_backup_get_file(resource  $file, boolean  $testFull) : resource

Method clone_backup_get_file()

Get the backup file to download and clone.

Parameters

resource $file

Backup file to be downloaded.

boolean $testFull

Return true if the file exists.

Throws

\Exception

Error message.

Returns

resource —

Return the backup file.

clone_backup_delete_files()

clone_backup_delete_files(array  $plugins, array  $themes) : array

Method clone_backup_delete_files()

Delete unneeded files (plugins and themes).

Parameters

array $plugins

Array containig plugins to be kept.

array $themes

Array containig themes to be kept.

Returns

array —

Array containing output feedback.