$instance
$instance : mixed
Public static variable to hold the single instance of the class.
Class MainWP_Utility
MainWP Utility
send_wp_mail(string|array $to, string $subject, string $message, string|array $headers = '') : boolean
Method send_wp_mail()
Sends notification email.
string|array | $to | Array or comma-separated list of email addresses to send message. |
string | $subject | Email subject. |
string | $message | Message contents. |
string|array | $headers | Optional. Additional headers. |
Whether the email contents were sent successfully.
upload_image(string $img_url, array $img_data = array(), boolean $check_file_existed = false, integer $parent_id) : null
Method upload_image()
Upload images from the MainWP Dashboard while posting Posts and/or Pages.
string | $img_url | Contains image URL. |
array | $img_data | Contains image data. |
boolean | $check_file_existed | Does the file exist? True or false. |
integer | $parent_id | Attachment parent post ID. |
Error message.
NULL
get_maybe_existed_attached_id(string $filename, boolean $full_guid = true) : integer
Method get_maybe_existed_attached_id()
If the media file exists, get the attachment ID.
string | $filename | Contains the media file name. |
boolean | $full_guid | Full global unique identifier. |
Attachment ID.
verify_nonce_without_session(string $nonce, mixed $action = -1) : mixed
Method verify_nonce_without_session()
Verify nonce without session.
string | $nonce | Nonce to verify. |
mixed | $action | Action to perform. |
If verified return 1 or 2, if not return false.
hook_create_nonce_action(boolean $false_value, mixed $action = -1) : string
Method hook_create_nonce_action()
Create nonce without session and user id.
boolean | $false_value | Boolean value, it should always be FALSE. |
mixed | $action | Action to perform. |
Custom nonce.
hook_verify_authed_action_nonce(boolean $false_value, string $act_nonce = '') : mixed
Method hook_verify_authed_action_nonce()
Verify nonce without session and user id.
boolean | $false_value | Boolean value, it should always be FALSE. |
string | $act_nonce | Nonce action to verify. |
If verified return 1 or 2, if not return false.
update_lasttime_backup(string $by, string $time) : boolean
Method update_lasttime_backup()
Update the last backup timestap.
string | $by | Selected backup system. |
string | $time | Time of the backup exacution. |
true|false If updated, return true, if the last backup time not updated, return false.
remove_filters_by_hook_name(string $hook_name = '', integer $priority) : boolean
Method remove_filters_by_hook_name()
Remove filters with method name.
string | $hook_name | Contains the hook name. |
integer | $priority | Contains the priority value. |
Return false if filtr is not set.
esc_content(mixed $content, string $type = 'note', mixed $more_allowed = array()) : string
Method esc_content()
Escape content, allowed content (a,href,title,br,em,strong,p,hr,ul,ol,li,h1,h2 ... ).
mixed | $content | Content to escape. |
string | $type | Type of content. Default = note. |
mixed | $more_allowed | input allowed tags - options. |
Filtered content containing only the allowed HTML.
check_media_file_existed(string $upload_dir, string $filename, resource $temporary_file, string $local_img_path, string $local_img_url) : array
Method check_media_file_existed()
Check if the media file already exists.
string | $upload_dir | Contains upload directory path. |
string | $filename | Contains image (file) name. |
resource | $temporary_file | Temporary file. |
string | $local_img_path | Local media file path. |
string | $local_img_url | Local media file URL. |
Media file ID and URL.
insert_attachment_media(array $img_data, string $img_url, integer $parent_id, string $local_img_path, string $local_img_url) : array
Method insert_attachment_media()
Insterd attachment media.
array | $img_data | Array containing image data. |
string | $img_url | Contains the media file URL. |
integer | $parent_id | Attachment parent post ID. |
string | $local_img_path | Contains the local media file path. |
string | $local_img_url | Contains the local media file URL. |
Media file ID and URL.