Properties

$instance

$instance : mixed

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

Type

mixed — Default null

Methods

get_class_name()

get_class_name() : object

Method get_class_name()

Get Class Name.

Returns

object

is_admin()

is_admin() : boolean

Method is_admin()

Check if current user is an administrator.

Returns

boolean —

True|False.

current_user_has_role()

current_user_has_role(array|string  $roles, object|null  $user = null) : boolean

Method current_user_has_role()

Check if the user has role.

Parameters

array|string $roles

role or array of roles to check.

object|null $user

user check.

Returns

boolean —

true|false If the user is administrator (Level 10), return true, if not, return false.

get_primary_backup()

get_primary_backup() : mixed

Method get_primary_backup()

Check if using Legacy Backup Solution.

Returns

mixed —

False|$enable_legacy_backup.

get_notification_email()

get_notification_email() : mixed

Method get_notification_email()

Check if user wants to recieve MainWP Notification Emails.

Returns

mixed —

null|User Email Address.

get_base_dir()

get_base_dir() : string

Method get_base_dir()

Get the base upload directory.

Returns

string —

basedir/

get_icons_dir()

get_icons_dir() : array

Method get_icons_dir()

Get MainWP icons directory, if it doesn't exist create it.

Returns

array —

$dir, $url

touch()

touch(string  $filename) 

Method touch().

If the file does not exist, it will be created.

Parameters

string $filename

File name.

is_writable()

is_writable(string  $file) 

Method is_writable().

Parameters

string $file

The file.

get_mainwp_dir()

get_mainwp_dir(string|null  $subdir = null, boolean  $direct_access = false) : array

Method get_mainwp_dir()

Get the MainWP directory, if it doesn't exist create it.

Parameters

string|null $subdir

mainwp sub diectories.

boolean $direct_access

Return true if Direct access file system. Default: false.

Returns

array —

$dir, $url

get_mainwp_sub_dir()

get_mainwp_sub_dir(string|null  $subdir = null, boolean  $direct_access = false) : string

Method get_mainwp_sub_dir()

Get the MainWP directory, if it doesn't exist create it.

Parameters

string|null $subdir

mainwp sub diectories.

boolean $direct_access

Return true if Direct access file system. Default: false.

Returns

string —

$dir mainwp sub-directory.

get_download_url()

get_download_url(mixed  $what, mixed  $filename) : string

Method get_download_dir()

Parameters

mixed $what

What url.

mixed $filename

File Name.

Returns

string —

Download URL.

get_download_sig()

get_download_sig(string  $fullFile) : string

Method get_download_sig()

Parameters

string $fullFile

File Name.

Returns

string —

Sig Download URL.

valid_download_sig()

valid_download_sig(string  $file, string  $sig) : boolean

Method valid_download_sig()

Parameters

string $file

File Name.

string $sig

download.

Returns

boolean —

true|false.

get_mainwp_specific_dir()

get_mainwp_specific_dir(null  $dir = null) : string

Method get_mainwp_specific_dir()

Get MainWP Specific directory, if it doesn't exist create it.

Update .htaccess.

Parameters

null $dir

Current MainWP directory.

Returns

string —

$newdir

get_mainwp_specific_url()

get_mainwp_specific_url(mixed  $dir) : string

Method get_mainwp_specific_url()

Get MainWP specific URL.

Parameters

mixed $dir

MainWP Directory.

Returns

string —

MainWP URL.

get_mainwp_dir_allow_access()

get_mainwp_dir_allow_access(mixed  $sub_dir) 

Method get_mainwp_dir_allow_access()

Get MainWP specific sub folder allow access.

Parameters

mixed $sub_dir

MainWP Sub Directory.

get_wp_file_system()

get_wp_file_system() : boolean

Method get_wp_file_system()

Get WP file system & define Global Variable FS_METHOD.

Returns

boolean —

$init True.

can_edit_website()

can_edit_website(mixed  $website) : mixed

Method can_edit_website()

Check if current user can edit Child Site.

Parameters

mixed $website

Child Site.

Returns

mixed —

true|false|userid

get_site_tags()

get_site_tags(array  $item, boolean  $client_tag = false) : mixed

Gets site tags

Parameters

array $item

Array containing child site data.

boolean $client_tag

It is client tags or not.

Returns

mixed —

Single Row Classes Item.

client_tags_filter()

client_tags_filter(array  $item) : mixed

Filter client tags

Parameters

array $item

Array containing tags.

Returns

mixed —

Single Row Classes Item.

is_suspended_site()

is_suspended_site(mixed  $website = false) 

Method is_suspended_site()

Check if enable site.

Parameters

mixed $website

The website.

get_current_wpid()

get_current_wpid() : string

Method get_current_wpid()

Get current Child Site ID.

Returns

string —

$current_user->current_site_id Current Child Site ID.

set_current_wpid()

set_current_wpid(mixed  $wpid) 

Method set_current_wpid()

Set the current Child Site ID.

Parameters

mixed $wpid

Child Site ID.

get_page_id()

get_page_id(null  $screen = null) : string

Method get_page_id()

Get current Page ID.

Parameters

null $screen

Current Screen ID.

Returns

string —

$page Current page ID.

get_child_response()

get_child_response(mixed  $data) : \MainWP\Dashboard\json

Method get_child_response()

Get response from Child Site.

Parameters

mixed $data

Data to process.

Returns

\MainWP\Dashboard\json —

$data|true.

maybe_unserialyze()

maybe_unserialyze(mixed  $data) : mixed

Method maybe_unserialyze()

Check if $data is serialized, if it isn't then base64_decode it.

Parameters

mixed $data

Data to check.

Returns

mixed —

$data.

get_openssl_conf()

get_openssl_conf() 

Method get_openssl_conf()

Get dashboard openssl configuration.

get_tokens_site_values()

get_tokens_site_values(object  $site) : array

Get tokens of site.

Parameters

object $site

The website.

Returns

array —

Array of tokens.

replace_tokens_values()

replace_tokens_values(string  $str, array  $replace_tokens) : string

Replace site tokens.

Parameters

string $str

String data.

array $replace_tokens

array of tokens.

Returns

string —

content with replaced tokens.

set_time_limit()

set_time_limit(integer  $timeout) 

Set timeout limit.

Parameters

integer $timeout

timeout value.

get_plugin_theme_info()

get_plugin_theme_info(string  $what, array  $params = array()) 

Method get_plugin_theme_info().

Get WordPress plugin/theme info.

Parameters

string $what

'plugin' or 'theme'.

array $params

Plugin/Theme info params.

update_cached_icons()

update_cached_icons(string  $icon, string  $slug, string  $type, boolean  $custom_icon = false) 

Method update_cached_icons().

Update cached icons

Parameters

string $icon

The icon.

string $slug

slug.

string $type

Type: plugin|theme.

boolean $custom_icon

Custom icon or not. Default: false.

handle_get_icon()

handle_get_icon(string  $slug, string  $type) 

Method handle_get_icon()

Parameters

string $slug

Plugin slug.

string $type

Type: theme|plugin.

get_plugin_icon()

get_plugin_icon(string  $slug, boolean  $forced_get = false) 

Gets a plugin icon via API from WordPress.org

Parameters

string $slug

Plugin slug.

boolean $forced_get

Forced get icon, default: false.

get_theme_icon()

get_theme_icon(string  $slug, boolean  $forced_get = false) 

Gets a theme icon via API from WordPress.org

Parameters

string $slug

Theme slug.

boolean $forced_get

Forced get icon, default: false.

handle_upload_image()

handle_upload_image(string  $sub_folder, mixed  $file_uploader, mixed  $file_index, boolean  $file_subindex = false, integer  $max_width = 300, integer  $max_height = 300) 

Method handle_upload_image().

Handle upload icons.

Parameters

string $sub_folder

The sub folder.

mixed $file_uploader

The file uploader.

mixed $file_index

The index of file uploader.

boolean $file_subindex

Is file with sub index.

integer $max_width

max image width.

integer $max_height

max image height.

disabled_wpcore_update_by()

disabled_wpcore_update_by(string  $website) 

Method disabled_wpcore_update_by().

Get disabled wpcore update by.

Parameters

string $website

The website.

get_disabled_wpcore_update_host()

get_disabled_wpcore_update_host(mixed  $website) 

Method get_disabled_wpcore_update_host().

Get wpcore update disabled for the websites on FlyWheel host or Pressable host.

Parameters

mixed $website

data.

get_connect_sign_algorithm()

get_connect_sign_algorithm(mixed  $website) : mixed

Method get_connect_sign_algorithm().

Get supported sign algorithms.

Parameters

mixed $website

The Website object.

Returns

mixed —

$alg Algorithm connect.

is_valid_supported_sign_alg()

is_valid_supported_sign_alg(integer  $alg) 

Method is_valid_supported_sign_alg()

Check if is supported sign algorithms.

Parameters

integer $alg

The Sign Algo value.

get_open_ssl_sign_algos()

get_open_ssl_sign_algos() 

Method get_signature_alg()

Get custom signature algorithms.

get_default_map_site_fields()

get_default_map_site_fields() 

Method get_default_map_site_fields()

Get default map site fields.

get_staging_options_sites_view_for_current_users()

get_staging_options_sites_view_for_current_users() : string

Method get_staging_options_sites_view_for_current_users()

Get staging options sites view for current users.

Returns

string —

Site views.

fetch_wp_org_icons()

fetch_wp_org_icons(string  $slug, string  $type) 

Private function Fetch a plugin|theme icon via API from WordPress.org

Parameters

string $slug

Plugin|Theme slug.

string $type

Plugin|Theme.

get_plugin_theme_icon()

get_plugin_theme_icon(string  $slug, string  $type) 

Gets a plugin|theme icon to output.

Parameters

string $slug

Plugin|Theme slug.

string $type

Type icon, plugin|theme.