Ejemplo n.º 1
0
                    $error_message = ' - ' . $error_message;
                }
                $subject = sprintf(__('Backup of %s Failed', 'hmbkp'), $domain);
                $message = sprintf(__('BackUpWordPress was unable to backup your site %1$s.', 'hmbkp') . "\n\n" . __('Here are the errors that we\'re encountered:', 'hmbkp') . "\n\n" . '%2$s' . "\n\n" . __('If the errors above look like Martian, forward this email to %3$s and we\'ll take a look', 'hmbkp') . "\n\n" . __("Kind Regards,\nThe Apologetic BackUpWordPress Backup Emailing Robot", 'hmbkp'), home_url(), $error_message, '*****@*****.**');
                wp_mail($this->get_email_address_array(), $subject, $message, $headers);
                return;
            }
            $subject = sprintf(__('Backup of %s', 'hmbkp'), $domain);
            // If it's larger than the max attachment size limit assume it's not going to be able to send the backup
            if (@filesize($file) < hmbkp_get_max_attachment_size()) {
                $message = sprintf(__('BackUpWordPress has completed a backup of your site %1$s.', 'hmbkp') . "\n\n" . __('The backup file should be attached to this email.', 'hmbkp') . "\n\n" . __('You can download the backup file by clicking the link below:', 'hmbkp') . "\n\n" . '%2$s' . "\n\n" . __("Kind Regards,\nThe Happy BackUpWordPress Backup Emailing Robot", 'hmbkp'), home_url(), $download);
                $sent = wp_mail($this->get_email_address_array(), $subject, $message, $headers, $file);
            }
            // If we didn't send the email above then send just the notification
            if (!$sent) {
                $message = sprintf(__('BackUpWordPress has completed a backup of your site %1$s.', 'hmbkp') . "\n\n" . __('Unfortunately the backup file was too large to attach to this email.', 'hmbkp') . "\n\n" . __('You can download the backup file by clicking the link below:', 'hmbkp') . "\n\n" . '%2$s' . "\n\n" . __("Kind Regards,\nThe Happy BackUpWordPress Backup Emailing Robot", 'hmbkp'), home_url(), $download);
                wp_mail($this->get_email_address_array(), $subject, $message, $headers);
            }
        }
    }
    public static function intercom_data()
    {
        return array();
    }
    public static function intercom_data_html()
    {
    }
}
// Register the service
HMBKP_Services::register(__FILE__, 'HMBKP_Email_Service');
     * Not in use
     * $return null
     */
    public function update(&$new_data, $old_data)
    {
    }
    /**
     * Used to determine if the service is in use or not
     */
    public function is_service_active()
    {
        return strlen($this->get_url()) > 0;
    }
    /**
     * @return string
     */
    protected function get_url()
    {
        return defined('WPRP_PLUGIN_SLUG') && get_option('wpr_api_key') ? $this->wpremote_webhook_url : false;
    }
    /**
     * @return string
     */
    protected function get_secret_key()
    {
        return get_option('wpr_api_key');
    }
}
// Register the service
HMBKP_Services::register(__FILE__, 'HMBKP_Webhook_WPRemote_Service');