Methods

__construct()

__construct() 

MainWP_Hooks constructor.

Initialize MainWP_Hooks actions/filters upon creation of the object.

mainwp_log_debug()

mainwp_log_debug(string  $text) 

Method mainwp_log_debug()

MainWP debug log.

Parameters

string $text

Debug text.

mainwp_log_info()

mainwp_log_info(string  $text) 

Method mainwp_log_info()

MainWP log info.

Parameters

string $text

Info Text.

mainwp_log_warning()

mainwp_log_warning(string  $text) 

Method mainwp_log_warning()

MainWP log warning.

Parameters

string $text

Warning text.

enqueue_meta_boxes_scripts()

enqueue_meta_boxes_scripts() 

Method enqueue_meta_boxes_scripts()

Enqueue Scripts for all Meta boxes.

mainwp_add_site()

mainwp_add_site(array  $params) : array

Method mainwp_add_site()

Hook to add Child Site.

Parameters

array $params

site data fields: url, name, wpadmin, unique_id, groupids, ssl_verify, ssl_version, http_user, http_pass, websiteid - if edit site.

Throws

\Exception

Exception message.

Returns

array —

$ret data fields: response, siteid.

hook_delete_site()

hook_delete_site(boolean  $site_id = false) : boolean|array

Method hook_delete_site()

Hook to delete Child Site.

Parameters

boolean $site_id

Child site ID.

Returns

boolean|array —

Return false if empty and return array error - Site not found | result - SUCCESS.

filter_clone_site()

filter_clone_site(mixed  $pluginFile, mixed  $key, mixed  $websiteid, mixed  $cloneid, mixed  $clone_url, boolean  $force_update = false) : array

Method filter_clone_site()

Hook to clone site.

Parameters

mixed $pluginFile

Plugin file.

mixed $key

Key.

mixed $websiteid

Child site ID.

mixed $cloneid

Clone site ID.

mixed $clone_url

Clone site URL.

boolean $force_update

Force the update, true|false, Default: false.

Returns

array —

Site array to clone.

filter_delete_clone_site()

filter_delete_clone_site(mixed  $pluginFile, mixed  $key, string  $clone_url = '', boolean  $clone_site_id = false) : array

Method filter_delete_clone_site()

Hook to delete cloaned Child Site.

Parameters

mixed $pluginFile

Plugin file.

mixed $key

Key.

string $clone_url

Clone site URL.

boolean $clone_site_id

Clone site ID.

Returns

array —

Site array to delete.

mainwp_edit_site()

mainwp_edit_site(array  $params) : array

Method mainwp_edit_site()

Hook to edit Child Site.

Parameters

array $params

site data fields: websiteid, name, wpadmin, unique_id.

Throws

\Exception

Exception message.

Returns

array —

$ret Child site ID.

hook_add_sub_left_menu()

hook_add_sub_left_menu(string  $title, string  $slug, string  $href, integer  $level = 1, string  $parent_key = 'mainwp_tab') 

Method hook_add_sub_left_menu()

Hook to add MainWP Left Menu item.

Parameters

string $title

Menu title.

string $slug

Menu slug.

string $href

Menu link.

integer $level

Menu level.

string $parent_key

Parent menu.

get_activate_extension_notice()

get_activate_extension_notice(mixed  $pluginFile) : string

Method get_activate_extension_notice()

Check for inactive MainWP Extensions & return an activation warning message.

Parameters

mixed $pluginFile

MainWP Extension to check.

Returns

string —

Activation notice.

cache_getcontext()

cache_getcontext(string  $page) : array

Method cache_getcontext()

Get cached search context for given page.

Parameters

string $page

Current MainWP Page.

Returns

array —

Cached Search Array.

cache_echo_body()

cache_echo_body(string  $page) 

Method cache_echo_body()

Echo Cached Search Body.

Parameters

string $page

Current MainWP Page.

cache_init()

cache_init(string  $page) 

Method cache_init()

Initiate search session variables for the current page.

Parameters

string $page

Current MainWP Page.

cache_add_context()

cache_add_context(string  $page, mixed  $context) 

Method cache_add_context()

Hook to add time & Search Context session variable.

Parameters

string $page

Current MainWP Page.

mixed $context

Time of search.

cache_add_body()

cache_add_body(string  $page, mixed  $body) 

Method cache_add_body()

Hook to add Search Body Session variable.

Parameters

string $page

Current MainWP Page.

mixed $body

Search body.

select_sites_box()

select_sites_box(string  $title = '', string  $type = 'checkbox', boolean  $show_group = true, boolean  $show_select_all = true, string  $class = '', string  $style = '', array  $selected_websites = array(), array  $selected_groups = array()) 

Method select_sites_box()

Hook to select sites box.

Parameters

string $title

Input title.

string $type

Input type, radio.

boolean $show_group

Whether or not to show group, Default: true.

boolean $show_select_all

Whether to show select all.

string $class

Default = ''.

string $style

Default = ''.

array $selected_websites

Selected Child Sites.

array $selected_groups

Selected Groups.

hook_notify_user()

hook_notify_user(integer  $userId, string  $subject, string  $content) 

Method hook_notify_user()

Hook to send user a notification.

Parameters

integer $userId

User ID.

string $subject

Email Subject.

string $content

Email Content.

get_error_message()

get_error_message(object  $msg, object  $extra) : string

Method get_error_message()

Hook to get error message.

Parameters

object $msg

Error message.

object $extra

HTTP error message.

Returns

string —

Error message.

get_user_extension()

get_user_extension() : object

Method get_user_extension()

Hook to get user extension.

Returns

object —

$row User extension.

hook_get_site_options()

hook_get_site_options(mixed  $boolean, object  $website, string  $name = '') : string|null

Method hook_get_site_options()

Hook to get Child site options.

Parameters

mixed $boolean

Boolean check.

object $website

Child site object.

string $name

Option table name.

Returns

string|null —

Database query result (as string), or null on failure

hook_update_site_options()

hook_update_site_options(mixed  $boolean, object  $website, string  $option, string  $value) : string|null

Method hook_update_site_options()

Hook to get Child site options.

Parameters

mixed $boolean

Boolean check.

object $website

Child site object.

string $option

Option name.

string $value

Option value.

Returns

string|null —

Database query result (as string), or null on failure

hook_get_websites_by_user_id()

hook_get_websites_by_user_id(mixed  $boolean, integer  $userid, boolean  $selectgroups = false, null  $search_site = null, string  $orderBy = 'wp.url') : object|null

Get sites by user ID.

Parameters

mixed $boolean

Boolean check.

integer $userid

User ID.

boolean $selectgroups

Selected groups.

null $search_site

Site search field value.

string $orderBy

Order list by. Default: URL.

Returns

object|null —

Database query results or null on failure.

get_websites_by_url()

get_websites_by_url(string  $url) : array|object|null

Method get_websites_by_url()

Hook to get Child Site by URL.

Parameters

string $url

Child Site URL.

Returns

array|object|null —

Database query results.

hook_get_all_posts()

hook_get_all_posts(object  $sites, array  $post_data = array()) : \stdClass

Method hook_get_all_posts() Hook to get posts from sites.

Parameters

object $sites

Child Sites object.

array $post_data

with values: keyword, dtsstart, dtsstop, status, maxRecords, post_type.

Returns

\stdClass —

$output All posts data array.

hook_current_user_can()

hook_current_user_can(mixed  $input, string  $can_type, string  $which) : boolean

Method mainwp_current_user_have_right()

Check permission level by hook mainwp_currentusercan of Team Control extension

Parameters

mixed $input

Return value holder.

string $can_type

group or type of capabilities.

string $which

Which function to perform.

Returns

boolean —

$input Return true if the user can and false if they can not.

hook_escape_response()

hook_escape_response(mixed  $response, boolean  $fields = false, array  $more_allowed = array()) : mixed

Method hook_escape_response()

To escape response data.

Parameters

mixed $response

response data.

boolean $fields

fields of response data - option.

array $more_allowed

input allowed tags - option.

Throws

\Exception

Exception message.

Returns

mixed —

$response valid response data.

hook_secure_request()

hook_secure_request(string  $action = '', string  $query_arg = 'security') 

Method hook_secure_request()

Security check to request parameter

Parameters

string $action

Action to perform.

string $query_arg

Query argument.

hook_get_mainwp_dir()

hook_get_mainwp_dir(boolean  $false = false, null  $dir = null, boolean  $direct_access = false) : array

Method hook_get_mainwp_dir()

Hook to get MainWP Directory.

Parameters

boolean $false

False.

null $dir

WP files system diectories.

boolean $direct_access

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

Returns

array —

$newdir, $url.

is_multi_user()

is_multi_user() : boolean

Method is_multi_user()

Hook to check if multi user.

Returns

boolean —

true|false.

filter_qq2_file_uploader()

filter_qq2_file_uploader(mixed  $allowedExtensions, mixed  $sizeLimit) : \MainWP\Dashboard\MainWP_QQ2_File_Uploader

Method filter_qq2_file_uploader()

Hook to create new MainWP_QQ2_File_Uploader() class.

Parameters

mixed $allowedExtensions

Allowed files extentions.

mixed $sizeLimit

Maximum file size allowed to be uploaded.

Returns

\MainWP\Dashboard\MainWP_QQ2_File_Uploader

Return instance of MainWP_QQ2_File_Uploader

get_metaboxes_post()

get_metaboxes_post() : string|boolean

Method get_metaboxes_post()

Hook to get meta boxes.

Returns

string|boolean —

Return error or true.

get_formated_email()

get_formated_email(mixed  $body, mixed  $email, string  $title = '') : string|boolean

Method get_formated_email()

Hook to format email.

Parameters

mixed $body

Email body.

mixed $email

Email address.

string $title

Email title.

Returns

string|boolean —

Return error or true.

active_plugin()

active_plugin() 

Method active_plugin()

Hook to activate plugins.

deactive_plugin()

deactive_plugin() 

Method deactive_plugin()

Hook to deactivate plugins.

delete_plugin()

delete_plugin() 

Method delete_plugin()

Hook to delete plugins.

delete_theme()

delete_theme() 

Method delete_theme()

Hook to delete theme()

upgrade_plugin_theme()

upgrade_plugin_theme() 

Method upgrade_plugin_theme()

Hook to update theme.

hook_get_websites_by_group_ids()

hook_get_websites_by_group_ids(mixed  $ids, null  $userId = null) : \MainWP\Dashboard\(object|\MainWP\Dashboard\null)

Method hook_get_websites_by_group_ids()

Hook to get Child Sites by group ID.

Parameters

mixed $ids

Group IDs.

null $userId

Current user ID.

Returns

\MainWP\Dashboard\(object|\MainWP\Dashboard\null) —

Database query result for get Child Sites by group ID or null on failure.