Methods

get_class_name()

get_class_name() : object

Method get_class_name()

Get Class Name.

Returns

object —

Class name.

try_visit()

try_visit(string  $url, boolean  $ssl_verifyhost = null, string  $http_user = null, string  $http_pass = null, integer  $sslVersion, boolean  $forceUseIPv4 = null, boolean  $no_body = false) : array

Method try visit.

Try connecting to Child Site via cURL.

Parameters

string $url

Child Site URL.

boolean $ssl_verifyhost

Option to check SSL Certificate. Default = null.

string $http_user

HTTPAuth Username. Default = null.

string $http_pass

HTTPAuth Password. Default = null.

integer $sslVersion

Child Site SSL Version.

boolean $forceUseIPv4

Option to force IP4. Default = null.

boolean $no_body

Option to set CURLOPT_NOBODY option. Default = false.

Returns

array —

$out. 'host IP, Returned HTTP Code, Error Message, http Status error message.

check_ignored_http_code()

check_ignored_http_code(mixed  $value) : \MainWP\Dashboard\bolean

Method check_ignored_http_code()

Check if http error code is being ignored.

Parameters

mixed $value

http error code.

Returns

\MainWP\Dashboard\bolean —

True|False.

check_website_status()

check_website_status(array  $website) : mixed

Method check_website_status()

Check if the Website returns and http errors.

Parameters

array $website

Child Site information.

Returns

mixed —

False|try visit result.

get_post_data_authed()

get_post_data_authed(mixed  $website, mixed  $what, null  $params = null) : mixed

Method get_post_data_authed()

Get authorized $_POST data & build query.

Parameters

mixed $website

Array of Child Site Info.

mixed $what

What we are posting.

null $params

Post parameters.

Returns

mixed —

null|http_build_query()

get_get_data_authed()

get_get_data_authed(mixed  $website, mixed  $paramValue, string  $paramName = 'where', boolean  $asArray = false, array  $other_params = array()) : string

Method get_get_data_authed()

Get authorized $_GET data & build query.

Parameters

mixed $website

Child Site data.

mixed $paramValue

OpenSSL parameter.

string $paramName

Parameter name.

boolean $asArray

true|false Default is false.

array $other_params

other params.

Returns

string —

$url

connect_sign()

connect_sign(string  $data, string  $signature, string  $privkey, mixed  $algorithm) : boolean

Method connect_sign()

Sign connect.

Parameters

string $data

Data sign.

string $signature

signature.

string $privkey

Private key.

mixed $algorithm

signature algorithm.

Returns

boolean —

Success or not.

get_post_data_not_authed()

get_post_data_not_authed(mixed  $url, mixed  $admin, mixed  $what, null  $params = null) : mixed

Method get_post_data_not_authed()

Get not authorized $_POST data.

Parameters

mixed $url

Child site URL.

mixed $admin

Admin Username.

mixed $what

What function to perform.

null $params

Function parameters.

Returns

mixed —

null|http_build_query()

fetch_urls_authed()

fetch_urls_authed(object  $websites, string  $what, array  $params, mixed  $handler, mixed  $output, mixed  $whatPage = null, array  $others = array()) : boolean

Method fetch_urls_authed()

Fetch authorized URLs.

Parameters

object $websites

Websites information.

string $what

Action to perform.

array $params

Request parameters.

mixed $handler

Request handler.

mixed $output

Request output.

mixed $whatPage

Request URL. Default /admin-ajax.php.

array $others

Request additional information.

Returns

boolean —

true|false

get_resource_id()

get_resource_id(mixed  $res) : \MainWP\Dashboard\$result

Method get_resource_id()

Get resource id.

Parameters

mixed $res

The given resource.

Returns

\MainWP\Dashboard\$result —

Resource ID only.

get_lock_identifier()

get_lock_identifier(mixed  $pLockName) : mixed

Method get_lock_identifier().

Get lock identifier.

Parameters

mixed $pLockName

Provided Lock Name.

Returns

mixed —

false|sem_get()|@fopen

lock()

lock(mixed  $identifier) : mixed

Method lock()

Use sem_acquire or @flock to lock the $identifier.

Parameters

mixed $identifier

Identifier.

Returns

mixed —

false|sem_acquire()|@flock

release()

release(mixed  $identifier) : mixed

Method release()

Use sem_release or @flock, @fclose to unlock $identifier.

Parameters

mixed $identifier

Identifier.

Returns

mixed —

false|sem_release()|@flock

fetch_url_authed()

fetch_url_authed(object  $website, string  $what, null  $params = null, boolean  $checkConstraints = false, boolean  $pForceFetch = false, boolean  $pRetryFailed = true, null  $rawResponse = null) : mixed

Method fetch_url_authed()

Updates the child site via authenticated request.

Parameters

object $website

Website information.

string $what

Function to perform.

null $params

Function parameters.

boolean $checkConstraints

Whether or not to check constraints.

boolean $pForceFetch

Whether or not to force the fetch.

boolean $pRetryFailed

Whether or not to retry the fetch process.

null $rawResponse

Raw response.

Returns

mixed —

$information

fetch_url_not_authed()

fetch_url_not_authed(string  $url, string  $admin, string  $what, null  $params = null, boolean  $pForceFetch = false, null  $verifyCertificate = null, null  $http_user = null, null  $http_pass = null, integer  $sslVersion, array  $others = array(), array  $output = array()) : mixed

Method fetch_url_not_authed()

Fetch not authorized URL.

Parameters

string $url

URL to fetch from.

string $admin

Admin name.

string $what

Function to perform.

null $params

Function parameters.

boolean $pForceFetch

true|false Whether or not to force the fetch.

null $verifyCertificate

Verify the SSL Certificate.

null $http_user

htaccess username.

null $http_pass

htaccess password.

integer $sslVersion

SSL version to check for.

array $others

Other functions to perform.

array $output

Output values.

Returns

mixed —

self::fetch_url() Fetch URL.

fetch_url()

fetch_url(object  $website, string  $url, mixed  $postdata, boolean  $checkConstraints = false, null  $verifyCertificate = null, boolean  $pRetryFailed = true, null  $http_user = null, null  $http_pass = null, integer  $sslVersion, array  $others = array(), array  $output = array()) : mixed

Method fetch_url()

Fetch URL.

Parameters

object $website

Child Site info.

string $url

URL to fetch from.

mixed $postdata

Post data to fetch.

boolean $checkConstraints

true|false Whether or not to check constraints.

null $verifyCertificate

Verify SSL Certificate.

boolean $pRetryFailed

ture|false Whether or not the Retry has failed.

null $http_user

htaccess username.

null $http_pass

htaccess password.

integer $sslVersion

SSL version.

array $others

Other functions to perform.

array $output

Output values.

Throws

\Exception

Exception message.

Returns

mixed —

self::fetch_url_site()

fetch_url_site()

fetch_url_site(object  $website, string  $url, mixed  $postdata, boolean  $checkConstraints = false, null  $verifyCertificate = null, null  $http_user = null, null  $http_pass = null, integer  $sslVersion, array  $others = array(), array  $output = array()) : mixed

Method fetch_url_site()

M Fetch URL.

Parameters

object $website

Child Site info.

string $url

URL to fetch from.

mixed $postdata

Post data to fetch.

boolean $checkConstraints

true|false Whether or not to check constraints.

null $verifyCertificate

Verify SSL Certificate.

null $http_user

htaccess username.

null $http_pass

htaccess password.

integer $sslVersion

SSL version.

array $others

Other functions to perform.

array $output

Output values.

Throws

\MainWP\Dashboard\MainWP_Exception

Exception message.

Returns

mixed —

$data, $information.

download_to_file()

download_to_file(mixed  $url, mixed  $file, boolean  $size = false, null  $http_user = null, null  $http_pass = null) 

Method download_to_file()

Download to file.

Parameters

mixed $url

Download URL.

mixed $file

File to download to.

boolean $size

Size of file.

null $http_user

htaccess username.

null $http_pass

htaccess password.

Throws

\MainWP\Dashboard\MainWP_Exception

Exception message.

init_cookiesdir()

init_cookiesdir(mixed  $cookieDir) : void

Method init_coockiesdir()

Check for cookies directory and create it if it doesn't already exist, set the file permissions and update htaccess.

Parameters

mixed $cookieDir

Cookies directory.

get_file_content()

get_file_content(mixed  $url) : mixed

Method get_file_content()

Get contents of file.

Parameters

mixed $url

File Location.

Returns

mixed —

false|$data

get_favico_url()

get_favico_url(mixed  $website) : mixed

Method get_favico_url()

Get Child Site favicon URL.

Parameters

mixed $website

Child Site info.

Returns

mixed —

$faviurl Favicon URL.

get_expect_header()

get_expect_header(string|array  $data) : string

Credits WordPress org.

Get the correct "Expect" header for the given request data.

Parameters

string|array $data

Data to send either as the POST body, or as parameters in the URL for a GET/HEAD.

Returns

string —

The "Expect" header.

get_renew_post_data_authed()

get_renew_post_data_authed(mixed  $website, mixed  $what) : mixed

Method get_renew_post_data_authed()

Get authorized $_POST data & build query for renew connection action only.

Parameters

mixed $website

Array of Child Site Info.

mixed $what

What we are posting.

Returns

mixed —

null|http_build_query()

check_constraints()

check_constraints(mixed  $identifier, mixed  $website) 

Method check_constraints()

Check connection delay constraints.

Parameters

mixed $identifier

Lock identifier.

mixed $website

Object child site.

check_constraints_last_request()

check_constraints_last_request(mixed  $identifier, integer  $minimumDelay, string|null  $ip = null) 

Method check_constraints_last_request().

Check constraints for last requests.

Parameters

mixed $identifier

connect identifier.

integer $minimumDelay

minimum delay.

string|null $ip

ip address.

check_constraints_open_requests()

check_constraints_open_requests(mixed  $identifier, integer  $maximumRequests, string|null  $ip = null) 

Method check_constraints_open_requests().

Check constraints for open requests.

Parameters

mixed $identifier

connect identifier.

integer $maximumRequests

maximum requests.

string|null $ip

ip address.