| Server IP : 103.48.194.25 / Your IP : 216.73.216.74 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/maysayhoaqua.com.vn-bk/public_html/wp-content/plugins/wp-smtp/inc/Logger/ |
Upload File : |
<?php
namespace WPSMTP\Logger;
use SolidWP\Mail\Admin\SettingsScreen;
use WP_Error;
use WPSMTP\Admin;
class Process {
private $mail_id;
private $wsOptions;
/**
* The new solid mail settings.
*
* @var false|mixed|null
*/
private $solidMailOptions;
public function __construct() {
global $wpdb;
$this->wsOptions = get_option( 'wp_smtp_options' );
$this->solidMailOptions = get_option( SettingsScreen::SETTINGS_SLUG );
if ( ! isset( $this->solidMailOptions['disable_logs'] ) || 'yes' !== $this->solidMailOptions['disable_logs'] ) {
add_filter( 'wp_mail', array( $this, 'log_mails' ), PHP_INT_MAX );
}
add_action( 'wp_mail_failed', array( $this, 'update_failed_status' ), PHP_INT_MAX );
}
public function log_mails( $parts ) {
global $wpdb;
$data = $parts;
unset( $data['attachments'] );
$this->mail_id = Db::get_instance()->insert( $data );
return $parts;
}
/**
* @param WP_Error $wp_error
*/
public function update_failed_status( $wp_error ) {
Admin::$phpmailer_error = $wp_error;
if ( ! isset( $this->wsOptions['disable_logs'] ) || 'yes' !== $this->wsOptions['disable_logs'] ) {
global $wpdb;
$data = $wp_error->get_error_data('wp_mail_failed' );
unset( $data['phpmailer_exception_code'] );
unset( $data['attachments'] );
$data['error'] = $wp_error->get_error_message();
if ( ! is_numeric( $this->mail_id ) ) {
Db::get_instance()->insert( $data );
} else {
Db::get_instance()->update( $data, array( 'mail_id' => $this->mail_id ) );
}
}
}
}