$instance
$instance : mixed
Public static variable to hold the single instance of the class.
Class MainWP_Helper
Helper functions.
get_mainwp_dir(string $what = null, boolean $die_on_error = true) : array
Method get_mainwp_dir()
Get the MainWP directory.
string | $what | Contains directory name. |
boolean | $die_on_error | If true, process will die on error, if false, process will continue. |
Error Message.
Return directory and directory URL.
check_dir(string $dir, boolean $die_on_error, integer $chmod = 493)
Method check_dir()
Check if the /mainwp/ direcorty is writable by server.
string | $dir | Contains directory path. |
boolean | $die_on_error | If true, process will die on error, if false, process will continue. |
integer | $chmod | Contains information about the directory permissions settings. |
Error message.
starts_with(string $haystack, string $needle) : boolean
Method starts_with()
Check if the String 1 starts with the String 2.
string | $haystack | Contains the String 1 for the comparison. |
string | $needle | Contains the String 2 for the comparison. |
true|false Return true if the comparison is positive, false if not.
ends_with(string $haystack, string $needle) : boolean
Method ends_with()
Check if the String 1 ends with the String 2.
string | $haystack | Contains the String 1 for the comparison. |
string | $needle | Contains the String 2 for the comparison. |
true|false Return true if the comparison is positive, false if not.
get_nice_url(string $url_to_clean, boolean $show_http = false) : string
Method get_nice_url()
Convert noraml URL to nice URL.
string | $url_to_clean | Contains the URL that needs to be cleaned. |
boolean | $show_http | True to include HTTP|HTTPS in URL. |
$url Cleaned (nice) URL.
human_filesize(integer $bytes, integer $decimals = 2) : string
Method human_filesize()
Convert filesize to more user-friendly format.
integer | $bytes | Contains the value in bytes to convert. |
integer | $decimals | Contains the number of decimal places to round. |
Value converted to more user-friendly format.
update_option(string $option_name, string $option_value, string $autoload = 'no') : boolean
Method update_option()
Update option.
string | $option_name | Contains the option name. |
string | $option_value | Contains the option value. |
string | $autoload | Autoload? Yes or no. |
$success true|false Option updated.
in_excludes(array $excludes, string $value) : boolean
Method in_excludes()
Check if the value is in the excludes list.
array | $excludes | Array containing the list of excludes. |
string | $value | Value to check. |
true|false If in excluded list, return true, if not, return false.
current_user_has_role(string|array $roles, object|null $user = null) : boolean
Method current_user_has_role()
Check if the user has role.
string|array | $roles | role or array of roles to check. |
object|null | $user | user check. |
true|false If the user is administrator (Level 10), return true, if not, return false.
check_files_exists(array $files = array(), boolean $return_results = false) : mixed
Method check_files_exists()
Check if a certain files exist.
array | $files | Array containing list of files to check. |
boolean | $return_results | If true, return feedback. |
Error message.
If exists, return true, if not, return list of missing files.
check_classes_exists(array $classes = array(), boolean $return_results = false) : mixed
Method check_classes_exists()
Check if a certain classes exist.
array | $classes | Array containing list of classes to check. |
boolean | $return_results | If true, return feedback. |
Error message.
If exists, return true, if not, return list of missing classes.
check_methods(object $obj, array $methods = array(), boolean $return_results = false) : mixed
Method check_methods()
Check if a certain methods exist.
object | $obj | Object to check. |
array | $methods | Array containing list of methods to check. |
boolean | $return_results | If true, return feedback. |
Error message.
If exists, return true, if not, return list of missing methods.
check_properties(object $obj, array $properties = array(), boolean $return_results = false) : mixed
Method check_properties()
Check if a certain properties exist.
object | $obj | Object to check. |
array | $properties | Array containing list of properties to check. |
boolean | $return_results | If true, return feedback. |
Error message.
If exists, return true, if not, return list of missing properties.
check_functions(array $funcs = array(), boolean $return_results = false) : mixed
Method check_functions()
Check if a certain functions exist.
array | $funcs | Array containing list of functions to check. |
boolean | $return_results | If true, return feedback. |
Error message.
If exists, return true, if not, return list of missing functions.