\MainWP\ChildMainWP_Child_Misc

Class MainWP_Child_Misc

Misc functions that don't really belong anywhere else.

Summary

Methods
Properties
Constants
get_class_name()
__construct()
get_instance()
get_site_icon()
get_favicon()
get_security_stats()
do_security_fix()
do_security_un_fix()
settings_tools()
uploader_action()
uploader_upload_file()
code_snippet()
snippet_update_wp_config()
No public properties found
No constants found
No protected methods found
$instance
N/A
try_to_parse_favicon()
sanitize_file_name()
snippet_save_snippet()
snippet_delete_snippet()
No private properties found
N/A

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.

__construct()

__construct() 

MainWP_Child_Misc constructor.

Run any time class is called.

get_instance()

get_instance() : mixed

Method get_instance()

Create a public static instance.

Returns

mixed —

Class instance.

get_site_icon()

get_site_icon() 

Method get_site_icon()

Fire off the get favicon function and add to sync information.

get_favicon()

get_favicon(boolean  $parse_page = false) : string|boolean

Method get_favicon()

Get the child site favicon.

Parameters

boolean $parse_page

Whether or not to parse the page. Default: false.

Returns

string|boolean —

Return favicon URL on success, FALSE on failure.

do_security_un_fix()

do_security_un_fix() 

Method do_security_un_fix()

Unfix fixed child site security issues.

uploader_action()

uploader_action() : void

Method uploader_action()

Initiate the file upload action.

uploader_upload_file()

uploader_upload_file(string  $file_url, string  $path, string  $file_name) : array

Method uploader_upload_file()

Upload file from the MainWP Dashboard.

Parameters

string $file_url

URL of file to be uploaded.

string $path

Path to upload to.

string $file_name

Name of file to upload.

Throws

\Exception

Error message.

Returns

array —

Full path and file name of uploaded file.

snippet_update_wp_config()

snippet_update_wp_config(string  $action, string  $slug, string  $code = '') : boolean

Method snippet_update_wp_config()

Update the child site wp-config.php file.

Parameters

string $action

Action to perform: Delete, Save.

string $slug

Snippet slug.

string $code

Code snippet.

Returns

boolean —

If remvoed, return true, if not, return false.

try_to_parse_favicon()

try_to_parse_favicon(string  $site_url) : string

Method try_to_parse_favicon()

Try to parse child site URL for favicon.

Parameters

string $site_url

Child site URL.

Returns

string —

Parsed favicon.

sanitize_file_name()

sanitize_file_name(string  $filename) : string

Sanitizes a filename, replacing whitespace with dashes.

Removes special characters that are illegal in filenames on certain operating systems and special characters requiring special escaping to manipulate at the command line. Replaces spaces and consecutive dashes with a single dash. Trims period, dash and underscore from beginning and end of filename. It is not guaranteed that this function will return a filename that is allowed to be uploaded.

Parameters

string $filename

The filename to be sanitized.

Returns

string —

The sanitized filename.

snippet_save_snippet()

snippet_save_snippet(string  $slug, string  $type, string  $code, array  $snippets) : array

Method snippet_save_snippet()

Save code snippet.

Parameters

string $slug

Snippet slug.

string $type

Type of snippet.

string $code

Snippet code.

array $snippets

An array containing all snippets.

Returns

array —

$return Status response.

snippet_delete_snippet()

snippet_delete_snippet(string  $slug, string  $type, array  $snippets) : array

Method snippet_delete_snippet()

Delete code snippet.

Parameters

string $slug

Snippet slug.

string $type

Type of snippet.

array $snippets

An array containing all snippets.

Returns

array —

$return Status response.