Properties

$instance

$instance : mixed

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

Type

mixed — Default null

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.

run_saved_snippets()

run_saved_snippets() : void

Method run_saved_snippets()

Fire off MainWP Code Snippets Extension code snipets execution.

execute_snippet()

execute_snippet(string  $code) : array

Method execute_snippet()

Execute MainWP Code Snippets Extension custom code snippets.

Parameters

string $code

Custom code snippet code (content).

Returns

array —

Array contaning result information.

fix_for_custom_themes()

fix_for_custom_themes() 

Method fix_for_custom_themes()

Custom fix for the Elegant Themes products compatibility.

maintenance_alert()

maintenance_alert() 

Method maintenance_alert()

MainWP Maintenance Extension feature to send email notification for 404 (Page not found) errors.

format_email()

format_email(string  $to_email, string  $body) : string

Method format_email()

Format emails.

Parameters

string $to_email

Contains the send to email address.

string $body

Contains the email content.

Returns

string —

Return formatted email.

handle_shutdown()

handle_shutdown() 

Method handle_shutdown()

Handle fatal and compile errors.

handle_fatal_error()

handle_fatal_error() 

Method handle_fatal_error()

Handle fatal error for requests from the MainWP Dashboard.

cron_active()

cron_active() : void

Method cron_active()

Start job if in cron and run query args are set.

upload_file()

upload_file(mixed  $file, integer  $offset) 

Method upload_file()

Upload bacup fils to execute clone or restore proces.

Parameters

mixed $file

Backup file.

integer $offset

Offset value.

readfile_chunked()

readfile_chunked(string  $filename, integer  $offset) : mixed

Method readfile_chunked()

Read chunked backup file.

Parameters

string $filename

Backup file name.

integer $offset

Offset value.

Returns

mixed —

Close file.

upload_image()

upload_image(string  $img_url, array  $img_data = array(), boolean  $check_file_existed = false, integer  $parent_id) : null

Method upload_image()

Upload images from the MainWP Dashboard while posting Posts and/or Pages.

Parameters

string $img_url

Contains image URL.

array $img_data

Contains image data.

boolean $check_file_existed

Does the file exist? True or false.

integer $parent_id

Attachment parent post ID.

Throws

\Exception

Error message.

Returns

null —

NULL

get_maybe_existed_attached_id()

get_maybe_existed_attached_id(string  $filename, boolean  $full_guid = true) : integer

Method get_maybe_existed_attached_id()

If the media file exists, get the attachment ID.

Parameters

string $filename

Contains the media file name.

boolean $full_guid

Full global unique identifier.

Returns

integer —

Attachment ID.

fetch_url()

fetch_url(string  $url, array  $postdata) 

Method fetch_url()

Fire off the m_fetch_url() to execute communication with the MainWP Dashboard.

Parameters

string $url

Contains the URL.

array $postdata

Array containg the post request information.

Throws

string

$e Error message.

m_fetch_url()

m_fetch_url(string  $url, array  $postdata) 

Method fetch_url()

Execute communication with the MainWP Dashboard.

Parameters

string $url

Contains the URL.

array $postdata

Array containg the post request information.

Throws

\Exception

Error message.

validate_mainwp_dir()

validate_mainwp_dir() : boolean

Method validate_mainwp_dir()

Check if the /mainwp/ directory is writable.

Returns

boolean —

$done Is the /mainwp/ directory writable? True or false.

close_connection()

close_connection(array  $val = null) 

Method close_connection()

Close connection.

Parameters

array $val

Array containing connection information.

create_nonce_without_session()

create_nonce_without_session(mixed  $action = -1) : string

Method create_nonce_without_session()

Create nonce without session.

Parameters

mixed $action

Action to perform.

Returns

string —

Custom nonce.

verify_nonce_without_session()

verify_nonce_without_session(string  $nonce, mixed  $action = -1) : mixed

Method verify_nonce_without_session()

Verify nonce without session.

Parameters

string $nonce

Nonce to verify.

mixed $action

Action to perform.

Returns

mixed —

If verified return 1 or 2, if not return false.

update_lasttime_backup()

update_lasttime_backup(string  $by, string  $time) : boolean

Method update_lasttime_backup()

Update the last backup timestap.

Parameters

string $by

Selected backup system.

string $time

Time of the backup exacution.

Returns

boolean —

true|false If updated, return true, if the last backup time not updated, return false.

get_lasttime_backup()

get_lasttime_backup(string  $by) : mixed

Method get_lasttime_backup()

Get the last backup timestap.

Parameters

string $by

Selected backup system.

Returns

mixed —

If activated any of the supported backup systems, return the last backup timestamp.

check_media_file_existed()

check_media_file_existed(string  $upload_dir, string  $filename, resource  $temporary_file, string  $local_img_path, string  $local_img_url) : array

Method check_media_file_existed()

Check if the media file already exists.

Parameters

string $upload_dir

Contains upload directory path.

string $filename

Contains image (file) name.

resource $temporary_file

Temporary file.

string $local_img_path

Local media file path.

string $local_img_url

Local media file URL.

Returns

array —

Media file ID and URL.

insert_attachment_media()

insert_attachment_media(array  $img_data, string  $img_url, integer  $parent_id, string  $local_img_path, string  $local_img_url) : array

Method insert_attachment_media()

Insterd attachment media.

Parameters

array $img_data

Array containing image data.

string $img_url

Contains the media file URL.

integer $parent_id

Attachment parent post ID.

string $local_img_path

Contains the local media file path.

string $local_img_url

Contains the local media file URL.

Returns

array —

Media file ID and URL.