Файловый менеджер - Редактировать - /home/tuudkjt/globeasy/wp-includes/ID3/deprecated.zip
Назад
PK 4T1]��t t class-easywpsmtp-gag-mailer.phpnu ��� <?php class EasyWPSMTP_Gag_Mailer extends stdClass { //phpcs:ignore public function Send() { return true; } } PK 4T1]HH�� functions.phpnu ��� <?php function swpsmtp_uninstall() { // Don't delete plugin options. It is better to retain the options so if someone accidentally deactivates, the configuration is not lost. //delete_site_option('swpsmtp_options'); //delete_option('swpsmtp_options'); } PK 4T1]ixcG� G� class-easywpsmtp-admin.phpnu ��� <?php class EasyWPSMTP_Admin { public function admin_enqueue_scripts( $hook ) { // Load only on ?page=swpsmtp_settings if ( 'settings_page_swpsmtp_settings' !== $hook ) { return; } //generate secret code for self-destruct function $sd_code = md5( uniqid( 'swpsmtp', true ) ); set_transient( 'easy_wp_smtp_sd_code', $sd_code, 12 * 60 * 60 ); $core = EasyWPSMTP::get_instance(); $plugin_data = get_file_data( $core->plugin_file, array( 'Version' => 'Version' ), false ); $plugin_version = $plugin_data['Version']; wp_enqueue_style( 'swpsmtp_admin_css', $core->plugin_url . '/css/style.css', array(), '1.0' ); wp_register_script( 'swpsmtp_admin_js', $core->plugin_url . '/js/script.js', array(), $plugin_version, true ); $params = array( 'sd_redir_url' => get_admin_url(), 'sd_code' => $sd_code, 'clear_log_nonce' => wp_create_nonce( 'easy-wp-smtp-clear-log' ), 'str' => array( 'clear_log' => __( 'Are you sure want to clear log?', 'easy-wp-smtp' ), 'log_cleared' => __( 'Log cleared.', 'easy-wp-smtp' ), 'error_occured' => __( 'Error occurred:', 'easy-wp-smtp' ), 'sending' => __( 'Sending...', 'easy-wp-smtp' ), 'confirm_self_destruct' => __( 'Are you sure you want to delete ALL your settings and deactive plugin?', 'easy-wp-smtp' ), 'self_destruct_completed' => __( 'All settings have been deleted and plugin is deactivated.', 'easy-wp-smtp' ), ), ); wp_localize_script( 'swpsmtp_admin_js', 'easywpsmtp', $params ); wp_enqueue_script( 'swpsmtp_admin_js' ); } public function admin_menu() { add_options_page( __( 'Easy WP SMTP', 'easy-wp-smtp' ), __( 'Easy WP SMTP', 'easy-wp-smtp' ), 'manage_options', 'swpsmtp_settings', 'swpsmtp_settings' ); } } new EasyWPSMTP_Admin(); /** * Renders the admin settings menu of the plugin. * @return void */ function swpsmtp_settings() { $easy_wp_smtp = EasyWPSMTP::get_instance(); $enc_req_met = true; $enc_req_err = ''; //check if OpenSSL PHP extension is loaded and display warning if it's not if ( ! extension_loaded( 'openssl' ) ) { $class = 'notice notice-warning'; $message = __( "PHP OpenSSL extension is not installed on the server. It's required by Easy WP SMTP plugin to operate properly. Please contact your server administrator or hosting provider and ask them to install it.", 'easy-wp-smtp' ); printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); //also show encryption error message $enc_req_err .= __( 'PHP OpenSSL extension is not installed on the server. It is required for encryption to work properly. Please contact your server administrator or hosting provider and ask them to install it.', 'easy-wp-smtp' ) . '<br />'; $enc_req_met = false; } //check if server meets encryption requirements if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { $enc_req_err = ! empty( $enc_req_err ) ? $enc_req_err .= '<br />' : ''; // translators: %s is PHP version $enc_req_err .= sprintf( __( 'Your PHP version is %s, encryption function requires PHP version 5.3.0 or higher.', 'easy-wp-smtp' ), PHP_VERSION ); $enc_req_met = false; } echo '<div class="wrap" id="swpsmtp-mail">'; echo '<h2>' . esc_html( __( 'Easy WP SMTP Settings', 'easy-wp-smtp' ) ) . '</h2>'; echo '<div id="poststuff"><div id="post-body">'; $message = ''; $error = ''; $swpsmtp_options = get_option( 'swpsmtp_options' ); $smtp_test_mail = get_option( 'smtp_test_mail' ); $gag_password = '#easywpsmtpgagpass#'; if ( empty( $smtp_test_mail ) ) { $smtp_test_mail = array( 'swpsmtp_to' => '', 'swpsmtp_subject' => '', 'swpsmtp_message' => '', ); } if ( isset( $_POST['swpsmtp_form_submit'] ) ) { // check nounce if ( ! check_admin_referer( plugin_basename( __FILE__ ), 'swpsmtp_nonce_name' ) ) { $error .= ' ' . __( 'Nonce check failed.', 'easy-wp-smtp' ); } /* Update settings */ $swpsmtp_options['from_name_field'] = isset( $_POST['swpsmtp_from_name'] ) ? sanitize_text_field( wp_unslash( $_POST['swpsmtp_from_name'] ) ) : ''; $swpsmtp_options['force_from_name_replace'] = isset( $_POST['swpsmtp_force_from_name_replace'] ) ? 1 : false; $swpsmtp_options['sub_mode'] = isset( $_POST['swpsmtp_sub_mode'] ) ? 1 : false; if ( isset( $_POST['swpsmtp_from_email'] ) ) { if ( is_email( $_POST['swpsmtp_from_email'] ) ) { $swpsmtp_options['from_email_field'] = sanitize_email( $_POST['swpsmtp_from_email'] ); } else { $error .= ' ' . __( "Please enter a valid email address in the 'FROM' field.", 'easy-wp-smtp' ); } } if ( isset( $_POST['swpsmtp_reply_to_email'] ) ) { $swpsmtp_options['reply_to_email'] = sanitize_email( $_POST['swpsmtp_reply_to_email'] ); } if ( isset( $_POST['swpsmtp_bcc_email'] ) ) { $swpsmtp_options['bcc_email'] = sanitize_text_field( $_POST['swpsmtp_bcc_email'] );//Can contain comma seperated addresses. } if ( isset( $_POST['swpsmtp_email_ignore_list'] ) ) { $swpsmtp_options['email_ignore_list'] = sanitize_text_field( $_POST['swpsmtp_email_ignore_list'] ); } $swpsmtp_options['smtp_settings']['host'] = sanitize_text_field( stripslashes( $_POST['swpsmtp_smtp_host'] ) ); $swpsmtp_options['smtp_settings']['type_encryption'] = ( isset( $_POST['swpsmtp_smtp_type_encryption'] ) ) ? sanitize_text_field( $_POST['swpsmtp_smtp_type_encryption'] ) : 'none'; $swpsmtp_options['smtp_settings']['autentication'] = ( isset( $_POST['swpsmtp_smtp_autentication'] ) ) ? sanitize_text_field( $_POST['swpsmtp_smtp_autentication'] ) : 'yes'; $swpsmtp_options['smtp_settings']['username'] = sanitize_text_field( stripslashes( $_POST['swpsmtp_smtp_username'] ) ); $swpsmtp_options['smtp_settings']['enable_debug'] = isset( $_POST['swpsmtp_enable_debug'] ) ? 1 : false; $swpsmtp_options['smtp_settings']['insecure_ssl'] = isset( $_POST['swpsmtp_insecure_ssl'] ) ? 1 : false; $swpsmtp_options['smtp_settings']['encrypt_pass'] = isset( $_POST['swpsmtp_encrypt_pass'] ) ? 1 : false; $smtp_password = sanitize_text_field( $_POST['swpsmtp_smtp_password'] ); if ( $smtp_password !== $gag_password ) { $swpsmtp_options['smtp_settings']['password'] = $easy_wp_smtp->encrypt_password( $smtp_password ); } if ( $swpsmtp_options['smtp_settings']['encrypt_pass'] && ! get_option( 'swpsmtp_pass_encrypted', false ) ) { update_option( 'swpsmtp_options', $swpsmtp_options ); $pass = $easy_wp_smtp->get_password(); $swpsmtp_options['smtp_settings']['password'] = $easy_wp_smtp->encrypt_password( $pass ); update_option( 'swpsmtp_options', $swpsmtp_options ); } $swpsmtp_options['enable_domain_check'] = isset( $_POST['swpsmtp_enable_domain_check'] ) ? 1 : false; if ( isset( $_POST['swpsmtp_allowed_domains'] ) ) { $swpsmtp_options['block_all_emails'] = isset( $_POST['swpsmtp_block_all_emails'] ) ? 1 : false; $swpsmtp_options['allowed_domains'] = base64_encode( sanitize_text_field( $_POST['swpsmtp_allowed_domains'] ) ); //phpcs:ignore } elseif ( ! isset( $swpsmtp_options['allowed_domains'] ) ) { $swpsmtp_options['allowed_domains'] = ''; } /* Check value from "SMTP port" option */ if ( isset( $_POST['swpsmtp_smtp_port'] ) ) { if ( empty( $_POST['swpsmtp_smtp_port'] ) || 1 > intval( $_POST['swpsmtp_smtp_port'] ) || ( ! preg_match( '/^\d+$/', intval($_POST['swpsmtp_smtp_port'] ) ) ) ) { $swpsmtp_options['smtp_settings']['port'] = '25'; $error .= ' ' . __( "Please enter a valid port in the 'SMTP Port' field.", 'easy-wp-smtp' ); } else { $swpsmtp_options['smtp_settings']['port'] = sanitize_text_field( $_POST['swpsmtp_smtp_port'] ); } } /* Update settings in the database */ if ( empty( $error ) ) { update_option( 'swpsmtp_options', $swpsmtp_options ); $message .= __( 'Settings saved.', 'easy-wp-smtp' ); } else { $error .= ' ' . __( 'Settings are not saved.', 'easy-wp-smtp' ); } } /* Send test letter */ $swpsmtp_to = ''; if ( isset( $_POST['swpsmtp_test_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'swpsmtp_test_nonce_name' ) ) { if ( isset( $_POST['swpsmtp_to'] ) ) { $to_email = sanitize_text_field( $_POST['swpsmtp_to'] ); if ( is_email( $to_email ) ) { $swpsmtp_to = $to_email; } else { $error .= __( 'Please enter a valid email address in the recipient email field.', 'easy-wp-smtp' ); } } $swpsmtp_subject = isset( $_POST['swpsmtp_subject'] ) ? sanitize_text_field( $_POST['swpsmtp_subject'] ) : ''; $swpsmtp_message = isset( $_POST['swpsmtp_message'] ) ? EasyWPSMTP_Utils::sanitize_textarea( $_POST['swpsmtp_message'] ) : ''; //Save the test mail details so it doesn't need to be filled in everytime. $smtp_test_mail['swpsmtp_to'] = $swpsmtp_to; $smtp_test_mail['swpsmtp_subject'] = $swpsmtp_subject; $smtp_test_mail['swpsmtp_message'] = $swpsmtp_message; update_option( 'smtp_test_mail', $smtp_test_mail ); if ( ! empty( $swpsmtp_to ) ) { $test_res = $easy_wp_smtp->test_mail( $swpsmtp_to, $swpsmtp_subject, $swpsmtp_message ); } } ?> <div class="updated fade" <?php echo empty( $message ) ? ' style="display:none"' : ''; ?>> <p><strong><?php echo esc_html( $message ); ?></strong></p> </div> <div class="error" <?php echo empty( $error ) ? 'style="display:none"' : ''; ?>> <p><strong><?php echo esc_html( $error ); ?></strong></p> </div> <div class="nav-tab-wrapper"> <a href="#smtp" data-tab-name="smtp" class="nav-tab"><?php esc_html_e( 'SMTP Settings', 'easy-wp-smtp' ); ?></a> <a href="#additional" data-tab-name="additional" class="nav-tab"><?php esc_html_e( 'Additional Settings', 'easy-wp-smtp' ); ?></a> <a href="#testemail" data-tab-name="testemail" class="nav-tab"><?php esc_html_e( 'Test Email', 'easy-wp-smtp' ); ?></a> <?php do_action( 'easy_wp_smtp_admin_settings_tabs_menu' ); ?> </div> <div class="swpsmtp-settings-container"> <div class="swpsmtp-settings-grid swpsmtp-settings-main-cont"> <form autocomplete="off" id="swpsmtp_settings_form" method="post" action=""> <input type="hidden" id="swpsmtp-urlHash" name="swpsmtp-urlHash" value=""> <div class="swpsmtp-tab-container" data-tab-name="smtp"> <div class="postbox"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'SMTP Configuration Settings', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <p><?php esc_html_e( 'You can request your hosting provider for the SMTP details of your site. Use the SMTP details provided by your hosting provider to configure the following settings.', 'easy-wp-smtp' ); ?></p> <table class="form-table"> <tr valign="top"> <th scope="row"><?php esc_html_e( 'From Email Address', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_from_email" type="text" name="swpsmtp_from_email" value="<?php echo isset( $swpsmtp_options['from_email_field'] ) ? esc_attr( $swpsmtp_options['from_email_field'] ) : ''; ?>" /><br /> <p class="description"><?php esc_html_e( "This email address will be used in the 'From' field.", 'easy-wp-smtp' ); ?></p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'From Name', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_from_name" type="text" name="swpsmtp_from_name" value="<?php echo isset( $swpsmtp_options['from_name_field'] ) ? esc_attr( $swpsmtp_options['from_name_field'] ) : ''; ?>" /><br /> <p class="description"><?php esc_html_e( "This text will be used in the 'FROM' field", 'easy-wp-smtp' ); ?></p> <p> <label><input type="checkbox" id="swpsmtp_force_from_name_replace" name="swpsmtp_force_from_name_replace" value="1" <?php echo ( isset( $swpsmtp_options['force_from_name_replace'] ) && ( $swpsmtp_options['force_from_name_replace'] ) ) ? ' checked' : ''; ?> /> <?php esc_html_e( 'Force From Name Replacement', 'easy-wp-smtp' ); ?></label> </p> <p class="description"><?php esc_html_e( "When enabled, the plugin will set the above From Name for each email. Disable it if you're using contact form plugins, it will prevent the plugin from replacing form submitter's name when contact email is sent.", 'easy-wp-smtp' ); ?> <br /> <?php esc_html_e( "If email's From Name is empty, the plugin will set the above value regardless.", 'easy-wp-smtp' ); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Reply-To Email Address', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_reply_to_email" type="email" name="swpsmtp_reply_to_email" value="<?php echo isset( $swpsmtp_options['reply_to_email'] ) ? esc_attr( $swpsmtp_options['reply_to_email'] ) : ''; ?>" /><br /> <p class="description"><?php esc_html_e( "Optional. This email address will be used in the 'Reply-To' field of the email. Leave it blank to use 'From' email as the reply-to value.", 'easy-wp-smtp' ); ?></p> <p> <label><input type="checkbox" id="swpsmtp_sub_mode" name="swpsmtp_sub_mode" value="1" <?php echo ( isset( $swpsmtp_options['sub_mode'] ) && ( $swpsmtp_options['sub_mode'] ) ) ? ' checked' : ''; ?> /> <?php esc_html_e( 'Substitute Mode', 'easy-wp-smtp' ); ?></label> </p> <p class="description"><?php esc_html_e( 'When enabled, the plugin will substitute occurances of the above From Email with the Reply-To Email address. The Reply-To Email will still be used if no other Reply-To Email is present. This option can prevent conflicts with other plugins that specify reply-to email addresses but still replaces the From Email with the Reply-To Email.', 'easy-wp-smtp' ); ?></p> <p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'BCC Email Address', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_bcc_email" type="text" name="swpsmtp_bcc_email" value="<?php echo isset( $swpsmtp_options['bcc_email'] ) ? esc_attr( $swpsmtp_options['bcc_email'] ) : ''; ?>" /><br /> <p class="description"><?php esc_html_e( "Optional. This email address will be used in the 'BCC' field of the outgoing emails. Use this option carefully since all your outgoing emails from this site will add this address to the BCC field. You can also enter multiple email addresses (comma separated).", 'easy-wp-smtp' ); ?></p> </td> </tr> <tr class="ad_opt swpsmtp_smtp_options"> <th><?php esc_html_e( 'SMTP Host', 'easy-wp-smtp' ); ?></th> <td> <input id='swpsmtp_smtp_host' type='text' name='swpsmtp_smtp_host' value='<?php echo isset( $swpsmtp_options['smtp_settings']['host'] ) ? esc_attr( $swpsmtp_options['smtp_settings']['host'] ) : ''; ?>' /><br /> <p class="description"><?php esc_html_e( 'Your mail server', 'easy-wp-smtp' ); ?></p> </td> </tr> <tr class="ad_opt swpsmtp_smtp_options"> <th><?php esc_html_e( 'Type of Encryption', 'easy-wp-smtp' ); ?></th> <td> <label for="swpsmtp_smtp_type_encryption_1"><input type="radio" id="swpsmtp_smtp_type_encryption_1" name="swpsmtp_smtp_type_encryption" value='none' <?php if ( isset( $swpsmtp_options['smtp_settings']['type_encryption'] ) && 'none' === $swpsmtp_options['smtp_settings']['type_encryption'] ) { echo 'checked="checked"';} ?> /> <?php esc_html_e( 'None', 'easy-wp-smtp' ); ?></label> <label for="swpsmtp_smtp_type_encryption_2"><input type="radio" id="swpsmtp_smtp_type_encryption_2" name="swpsmtp_smtp_type_encryption" value='ssl' <?php if ( isset( $swpsmtp_options['smtp_settings']['type_encryption'] ) && 'ssl' === $swpsmtp_options['smtp_settings']['type_encryption'] ) { echo 'checked="checked"';} ?> /> <?php esc_html_e( 'SSL/TLS', 'easy-wp-smtp' ); ?></label> <label for="swpsmtp_smtp_type_encryption_3"><input type="radio" id="swpsmtp_smtp_type_encryption_3" name="swpsmtp_smtp_type_encryption" value='tls' <?php if ( isset( $swpsmtp_options['smtp_settings']['type_encryption'] ) && 'tls' === $swpsmtp_options['smtp_settings']['type_encryption'] ) { echo 'checked="checked"';} ?> /> <?php esc_html_e( 'STARTTLS', 'easy-wp-smtp' ); ?></label><br /> <p class="description"><?php esc_html_e( 'For most servers SSL/TLS is the recommended option', 'easy-wp-smtp' ); ?></p> </td> </tr> <tr class="ad_opt swpsmtp_smtp_options"> <th><?php esc_html_e( 'SMTP Port', 'easy-wp-smtp' ); ?></th> <td> <input id='swpsmtp_smtp_port' type='text' name='swpsmtp_smtp_port' value='<?php echo isset( $swpsmtp_options['smtp_settings']['port'] ) ? esc_attr( $swpsmtp_options['smtp_settings']['port'] ) : ''; ?>' /><br /> <p class="description"><?php esc_html_e( 'The port to your mail server', 'easy-wp-smtp' ); ?></p> </td> </tr> <tr class="ad_opt swpsmtp_smtp_options"> <th><?php esc_html_e( 'SMTP Authentication', 'easy-wp-smtp' ); ?></th> <td> <label for="swpsmtp_smtp_autentication"><input type="radio" id="swpsmtp_smtp_autentication_1" name="swpsmtp_smtp_autentication" value='no' <?php if ( isset( $swpsmtp_options['smtp_settings']['autentication'] ) && 'no' === $swpsmtp_options['smtp_settings']['autentication'] ) { echo 'checked="checked"';} ?> /> <?php esc_html_e( 'No', 'easy-wp-smtp' ); ?></label> <label for="swpsmtp_smtp_autentication"><input type="radio" id="swpsmtp_smtp_autentication_2" name="swpsmtp_smtp_autentication" value='yes' <?php if ( isset( $swpsmtp_options['smtp_settings']['autentication'] ) && 'yes' === $swpsmtp_options['smtp_settings']['autentication'] ) { echo 'checked="checked"';} ?> /> <?php esc_html_e( 'Yes', 'easy-wp-smtp' ); ?></label><br /> <p class="description"><?php esc_html_e( "This options should always be checked 'Yes'", 'easy-wp-smtp' ); ?></p> </td> </tr> <tr class="ad_opt swpsmtp_smtp_options"> <th><?php esc_html_e( 'SMTP Username', 'easy-wp-smtp' ); ?></th> <td> <input id='swpsmtp_smtp_username' type='text' name='swpsmtp_smtp_username' value='<?php echo isset( $swpsmtp_options['smtp_settings']['username'] ) ? esc_attr( $swpsmtp_options['smtp_settings']['username'] ) : ''; ?>' /><br /> <p class="description"><?php esc_html_e( 'The username to login to your mail server', 'easy-wp-smtp' ); ?></p> </td> </tr> <tr class="ad_opt swpsmtp_smtp_options"> <th><?php esc_html_e( 'SMTP Password', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_smtp_password" type="password" name="swpsmtp_smtp_password" value="<?php echo esc_attr( ( $easy_wp_smtp->get_password() !== '' ? $gag_password : '' ) ); ?>" autocomplete="new-password" /><br /> <p class="description"><?php echo esc_html( __( 'The password to login to your mail server', 'easy-wp-smtp' ) ); ?></p> <p class="description"><b><?php echo esc_html( _x( 'Note:', '"Note" as in "Note: keep this in mind"', 'easy-wp-smtp' ) ); ?></b> <?php echo esc_html( __( 'when you click "Save Changes", your actual password is stored in the database and then used to send emails. This field is replaced with a gag (#easywpsmtpgagpass#). This is done to prevent someone with the access to Settings page from seeing your password (using password fields unmasking programs, for example).', 'easy-wp-smtp' ) ); ?></p> </td> </tr> </table> <p class="submit"> <input type="submit" id="settings-form-submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'easy-wp-smtp' ); ?>" /> <input type="hidden" name="swpsmtp_form_submit" value="submit" /> <?php wp_nonce_field( plugin_basename( __FILE__ ), 'swpsmtp_nonce_name' ); ?> </p> </div><!-- end of inside --> </div><!-- end of postbox --> </div> <div class="swpsmtp-tab-container" data-tab-name="additional"> <div class="postbox"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'Additional Settings (Optional)', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <table class="form-table"> <tr valign="top"> <th scope="row"><?php esc_html_e( "Don't Replace \"From\" Field", 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_email_ignore_list" type="text" name="swpsmtp_email_ignore_list" value="<?php echo isset( $swpsmtp_options['email_ignore_list'] ) ? esc_attr( $swpsmtp_options['email_ignore_list'] ) : ''; ?>" /><br /> <p class="description"><?php esc_html_e( 'Comma separated emails list. Example value: email1@domain.com, email2@domain.com', 'easy-wp-smtp' ); ?></p> <p class="description"><?php esc_html_e( "This option is useful when you are using several email aliases on your SMTP server. If you don't want your aliases to be replaced by the address specified in \"From\" field, enter them in this field.", 'easy-wp-smtp' ); ?></p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Enable Domain Check', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_enable_domain_check" type="checkbox" id="swpsmtp_enable_domain_check" name="swpsmtp_enable_domain_check" value="1" <?php echo ( isset( $swpsmtp_options['enable_domain_check'] ) && ( $swpsmtp_options['enable_domain_check'] ) ) ? ' checked' : ''; ?> /> <p class="description"><?php esc_html_e( 'This option is usually used by developers only. SMTP settings will be used only if the site is running on following domain(s):', 'easy-wp-smtp' ); ?></p> <input id="swpsmtp_allowed_domains" type="text" name="swpsmtp_allowed_domains" value="<?php echo esc_attr( EasyWPSMTP_Utils::base64_decode_maybe( $swpsmtp_options['allowed_domains'] ) ); ?>" <?php echo ( isset( $swpsmtp_options['enable_domain_check'] ) && ( $swpsmtp_options['enable_domain_check'] ) ) ? '' : ' disabled'; ?> /> <p class="description"><?php esc_html_e( 'Coma-separated domains list. Example: domain1.com, domain2.com', 'easy-wp-smtp' ); ?></p> <p> <label><input type="checkbox" id="swpsmtp_block_all_emails" name="swpsmtp_block_all_emails" value="1" <?php echo ( isset( $swpsmtp_options['block_all_emails'] ) && ( $swpsmtp_options['block_all_emails'] ) ) ? ' checked' : ''; ?><?php echo ( isset( $swpsmtp_options['enable_domain_check'] ) && ( $swpsmtp_options['enable_domain_check'] ) ) ? '' : ' disabled'; ?> /> <?php esc_html_e( 'Block all emails', 'easy-wp-smtp' ); ?></label> </p> <p class="description"><?php esc_html_e( 'When enabled, plugin attempts to block ALL emails from being sent out if domain mismatch.', 'easy-wp-smtp' ); ?></p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Encrypt Password', 'easy-wp-smtp' ); ?></th> <td> <?php if ( $enc_req_met ) { ?> <input id="swpsmtp_encrypt_pass" type="checkbox" name="swpsmtp_encrypt_pass" value="1" <?php echo ( isset( $swpsmtp_options['smtp_settings']['encrypt_pass'] ) && ( $swpsmtp_options['smtp_settings']['encrypt_pass'] ) ) ? 'checked' : ''; ?> /> <p class="description"><?php esc_html_e( 'When enabled, your SMTP password is stored in the database using AES-256 encryption.', 'easy-wp-smtp' ); ?></p> <?php } else { ?> <p style="color: red;"><?php echo esc_html( $enc_req_err ); ?></p> <?php } ?> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Allow Insecure SSL Certificates', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_insecure_ssl" type="checkbox" name="swpsmtp_insecure_ssl" value="1" <?php echo ( isset( $swpsmtp_options['smtp_settings']['insecure_ssl'] ) && ( $swpsmtp_options['smtp_settings']['insecure_ssl'] ) ) ? 'checked' : ''; ?> /> <p class="description"><?php esc_html_e( "Allows insecure and self-signed SSL certificates on SMTP server. It's highly recommended to keep this option disabled.", 'easy-wp-smtp' ); ?></p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Enable Debug Log', 'easy-wp-smtp' ); ?></th> <td> <input id="swpsmtp_enable_debug" type="checkbox" name="swpsmtp_enable_debug" value="1" <?php echo ( isset( $swpsmtp_options['smtp_settings']['enable_debug'] ) && ( $swpsmtp_options['smtp_settings']['enable_debug'] ) ) ? 'checked' : ''; ?> /> <p class="description"><?php esc_html_e( 'Check this box to enable mail debug log', 'easy-wp-smtp' ); ?> <br/> <b><?php echo esc_html( _x( 'Note:', '"Note" as in "Note: keep this in mind"', 'easy-wp-smtp' ) ); ?></b> <?php esc_html_e( 'debug log is reset when the plugin is activated, deactivated or updated.', 'easy-wp-smtp' ); ?> </p> <a href="<?php echo esc_attr( admin_url() ); ?>?swpsmtp_action=view_log" target="_blank"><?php esc_html_e( 'View Log', 'easy-wp-smtp' ); ?></a> | <a style="color: red;" id="swpsmtp_clear_log_btn" href="#0"><?php esc_html_e( 'Clear Log', 'easy-wp-smtp' ); ?></a> </td> </tr> </table> <p class="submit"> <input type="submit" id="additional-settings-form-submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'easy-wp-smtp' ); ?>" /> </p> </div><!-- end of inside --> </div><!-- end of postbox --> <div class="postbox"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'Danger Zone', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <p><?php esc_html_e( 'Actions in this section can (and some of them will) erase or mess up your settings. Use it with caution.', 'easy-wp-smtp' ); ?></p> <table class="form-table"> <!-- Requires plugin: easy-wp-smtp-export-import-settings --> <?php do_action("easy_wp_smtp_export_import_settings"); ?> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Delete Settings and Deactivate Plugin', 'easy-wp-smtp' ); ?></th> <td> <button id="swpsmtp_self_destruct_btn" style="color: red;" type="button" class="button button-secondary">>>> <?php esc_html_e( 'Self-destruct', 'easy-wp-smtp' ); ?> <<<</button> <p class="description"><?php esc_html_e( "This will remove ALL your settings and deactivate the plugin. Useful when you're uninstalling the plugin and want to completely remove all crucial data stored in the database.", 'easy-wp-smtp' ); ?></p> <p style="color: red; font-weight: bold;"><?php esc_html_e( "Warning! This can't be undone.", 'easy-wp-smtp' ); ?></p> </td> </tr> </table> </div> </div> </div> </form> <!-- Requires plugin: easy-wp-smtp-export-import-settings --> <?php do_action("easy_wp_smtp_export_import_hidden_forms_settings"); ?> <div class="swpsmtp-tab-container" data-tab-name="testemail"> <div class="postbox"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'Test Email', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <div id="swpsmtp-save-settings-notice" class="swpsmtp-msg-cont msg-error"><b><?php echo esc_html( _x( 'Note:', '"Note" as in "Note: keep this in mind"', 'easy-wp-smtp' ) ); ?></b> <?php esc_html_e( 'You have unsaved settings. In order to send a test email, you need to go back to previous tab and click "Save Changes" button first.', 'easy-wp-smtp' ); ?></div> <?php if ( isset( $test_res ) && is_array( $test_res ) ) { if ( isset( $test_res['error'] ) ) { $errmsg_class = ' msg-error'; $errmsg_text = '<b>' . esc_html__( 'Following error occurred when attempting to send test email:', 'easy-wp-smtp' ) . '</b><br />' . esc_html( $test_res['error'] ); } else { $errmsg_class = ' msg-success'; $errmsg_text = '<b>' . esc_html__( 'Test email was successfully sent. No errors occurred during the process.', 'easy-wp-smtp' ) . '</b>'; } ?> <div class="swpsmtp-msg-cont<?php echo esc_attr( $errmsg_class ); ?>"> <?php echo $errmsg_text; //phpcs:ignore?> <?php if ( isset( $test_res['debug_log'] ) ) { ?> <br /><br /> <a id="swpsmtp-show-hide-log-btn" href="#0"><?php esc_html_e( 'Show Debug Log', 'easy-wp-smtp' ); ?></a> <p id="swpsmtp-debug-log-cont"><textarea rows="20" style="width: 100%;"><?php echo esc_html( $test_res['debug_log'] ); ?></textarea></p> <script> jQuery(function($) { $('#swpsmtp-show-hide-log-btn').click(function(e) { e.preventDefault(); var logCont = $('#swpsmtp-debug-log-cont'); if (logCont.is(':visible')) { $(this).html('<?php esc_attr_e( 'Show Debug Log', 'easy-wp-smtp' ); ?>'); } else { $(this).html('<?php esc_attr_e( 'Hide Debug Log', 'easy-wp-smtp' ); ?>'); } logCont.toggle(); }); <?php if ( isset( $test_res['error'] ) ) { ?> $('#swpsmtp-show-hide-log-btn').click(); <?php } ?> }); </script> <?php } ?> </div> <?php } ?> <p><?php esc_html_e( 'You can use this section to send an email from your server using the above configured SMTP details to see if the email gets delivered.', 'easy-wp-smtp' ); ?></p> <p><b><?php echo esc_html( _x( 'Note:', '"Note" as in "Note: keep this in mind"', 'easy-wp-smtp' ) ); ?></b> <?php esc_html_e( 'debug log for this test email will be automatically displayed right after you send it. Test email also ignores "Enable Domain Check" option.', 'easy-wp-smtp' ); ?></p> <form id="swpsmtp_settings_test_email_form" method="post" action=""> <table class="form-table"> <tr valign="top"> <th scope="row"><?php esc_html_e( 'To', 'easy-wp-smtp' ); ?>:</th> <td> <input id="swpsmtp_to" type="text" class="ignore-change" name="swpsmtp_to" value="<?php echo esc_html( $smtp_test_mail['swpsmtp_to'] ); ?>" /><br /> <p class="description"><?php esc_html_e( "Enter the recipient's email address", 'easy-wp-smtp' ); ?></p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Subject', 'easy-wp-smtp' ); ?>:</th> <td> <input id="swpsmtp_subject" type="text" class="ignore-change" name="swpsmtp_subject" value="<?php echo esc_html( $smtp_test_mail['swpsmtp_subject'] ); ?>" /><br /> <p class="description"><?php esc_html_e( 'Enter a subject for your message', 'easy-wp-smtp' ); ?></p> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e( 'Message', 'easy-wp-smtp' ); ?>:</th> <td> <textarea name="swpsmtp_message" id="swpsmtp_message" rows="5"><?php echo esc_textarea( stripslashes( $smtp_test_mail['swpsmtp_message'] ) ); ?></textarea><br /> <p class="description"><?php esc_html_e( 'Write your email message', 'easy-wp-smtp' ); ?></p> </td> </tr> </table> <p class="submit"> <input type="submit" id="test-email-form-submit" class="button-primary" value="<?php esc_attr_e( 'Send Test Email', 'easy-wp-smtp' ); ?>" /> <input type="hidden" name="swpsmtp_test_submit" value="submit" /> <?php wp_nonce_field( plugin_basename( __FILE__ ), 'swpsmtp_test_nonce_name' ); ?> <span id="swpsmtp-spinner" class="spinner"></span> </p> </form> </div><!-- end of inside --> </div><!-- end of postbox --> </div> <?php do_action( 'easy_wp_smtp_admin_settings_tabs_content' ); ?> </div> <div class="swpsmtp-settings-grid swpsmtp-settings-sidebar-cont"> <div class="postbox" style="min-width: inherit;"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'Documentation', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <?php printf( esc_html( // translators: %s is replaced by documentation page URL _x( "Please visit the %s plugin's documentation page to learn how to use this plugin.", '%s is replaced by <a target="_blank" href="https://easywpsmtp.com/easy-wp-smtp-plugin-quick-setup-guide/">Easy WP SMTP</a>', 'easy-wp-smtp' ) ), '<a target="_blank" href="https://easywpsmtp.com/easy-wp-smtp-plugin-quick-setup-guide/">Easy WP SMTP</a>' ); ?> </div> </div> <div class="postbox" style="min-width: inherit;"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'Support', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <?php printf( esc_html( // translators: %s is replaced by support forum URL _x( 'Having issues or difficulties? You can post your issue on the %s', '%s is replaced by "Support Forum" link', 'easy-wp-smtp' ) ), sprintf( '<a href="https://wordpress.org/support/plugin/easy-wp-smtp/" target="_blank">%s</a>', esc_html( __( 'Support Forum', 'easy-wp-smtp' ) ) ) ); ?> </div> </div> <div class="postbox" style="min-width: inherit;"> <h3 class="hndle"><label for="title"><?php esc_html_e( 'Rate Us', 'easy-wp-smtp' ); ?></label></h3> <div class="inside"> <?php printf( esc_html( // translators: %s is replaced by rating link _x( 'Like the plugin? Please give us a %s', '%s is replaced by "rating" link', 'easy-wp-smtp' ) ), sprintf( '<a href="https://wordpress.org/support/plugin/easy-wp-smtp/reviews/#new-post" target="_blank">%s</a>', esc_html( __( 'rating', 'easy-wp-smtp' ) ) ) ); ?> <div class="swpsmtp-stars-container"> <a href="https://wordpress.org/support/plugin/easy-wp-smtp/reviews/" target="_blank"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span> </a> </div> </div> </div> </div> </div> <?php echo '</div></div>'; //<!-- end of #poststuff and #post-body --> echo '</div>'; //<!-- end of .wrap #swpsmtp-mail .swpsmtp-mail --> } PK 4T1]�mK K Cryptor.phpnu ��� <?php /** * Simple example of using the openssl encrypt/decrypt functions that * are inadequately documented in the PHP manual. * * Available under the MIT License * * The MIT License (MIT) * Copyright (c) 2016 ionCube Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace ioncube\phpOpensslCryptor; class Cryptor { private $cipher_algo; private $hash_algo; private $iv_num_bytes; private $format; const FORMAT_RAW = 0; const FORMAT_B64 = 1; const FORMAT_HEX = 2; /** * Construct a Cryptor, using aes256 encryption, sha256 key hashing and base64 encoding. * @param string $cipher_algo The cipher algorithm. * @param string $hash_algo Key hashing algorithm. * @param [type] $fmt Format of the encrypted data. */ public function __construct( $cipher_algo = 'aes-256-ctr', $hash_algo = 'sha256', $fmt = Cryptor::FORMAT_B64 ) { $this->cipher_algo = $cipher_algo; $this->hash_algo = $hash_algo; $this->format = $fmt; if ( ! in_array( $cipher_algo, openssl_get_cipher_methods( true ) ) ) { throw new \Exception( "Cryptor:: - unknown cipher algo {$cipher_algo}" ); } if ( ! in_array( $hash_algo, openssl_get_md_methods( true ) ) ) { throw new \Exception( "Cryptor:: - unknown hash algo {$hash_algo}" ); } $this->iv_num_bytes = openssl_cipher_iv_length( $cipher_algo ); } /** * Encrypt a string. * @param string $in String to encrypt. * @param string $key Encryption key. * @param int $fmt Optional override for the output encoding. One of FORMAT_RAW, FORMAT_B64 or FORMAT_HEX. * @return string The encrypted string. */ public function encryptString( $in, $key, $fmt = null ) { if ( $fmt === null ) { $fmt = $this->format; } // Build an initialisation vector $iv = openssl_random_pseudo_bytes( $this->iv_num_bytes, $isStrongCrypto ); if ( ! $isStrongCrypto ) { throw new \Exception( "Cryptor::encryptString() - Not a strong key" ); } // Hash the key $keyhash = openssl_digest( $key, $this->hash_algo, true ); // and encrypt $opts = OPENSSL_RAW_DATA; $encrypted = openssl_encrypt( $in, $this->cipher_algo, $keyhash, $opts, $iv ); if ( $encrypted === false ) { throw new \Exception( 'Cryptor::encryptString() - Encryption failed: ' . openssl_error_string() ); } // The result comprises the IV and encrypted data $res = $iv . $encrypted; // and format the result if required. if ( $fmt == Cryptor::FORMAT_B64 ) { $res = base64_encode( $res ); } else if ( $fmt == Cryptor::FORMAT_HEX ) { $unp = unpack( 'H*', $res ); $res = $unp[ 1 ]; } return $res; } /** * Decrypt a string. * @param string $in String to decrypt. * @param string $key Decryption key. * @param int $fmt Optional override for the input encoding. One of FORMAT_RAW, FORMAT_B64 or FORMAT_HEX. * @return string The decrypted string. */ public function decryptString( $in, $key, $fmt = null ) { if ( $fmt === null ) { $fmt = $this->format; } $raw = $in; // Restore the encrypted data if encoded if ( $fmt == Cryptor::FORMAT_B64 ) { $raw = base64_decode( $in ); } else if ( $fmt == Cryptor::FORMAT_HEX ) { $raw = pack( 'H*', $in ); } // and do an integrity check on the size. if ( strlen( $raw ) < $this->iv_num_bytes ) { throw new \Exception( 'Cryptor::decryptString() - ' . 'data length ' . strlen( $raw ) . " is less than iv length {$this->iv_num_bytes}" ); } // Extract the initialisation vector and encrypted data $iv = substr( $raw, 0, $this->iv_num_bytes ); $raw = substr( $raw, $this->iv_num_bytes ); // Hash the key $keyhash = openssl_digest( $key, $this->hash_algo, true ); // and decrypt. $opts = OPENSSL_RAW_DATA; $res = openssl_decrypt( $raw, $this->cipher_algo, $keyhash, $opts, $iv ); if ( $res === false ) { throw new \Exception( 'Cryptor::decryptString - decryption failed: ' . openssl_error_string() ); } return $res; } /** * Static convenience method for encrypting. * @param string $in String to encrypt. * @param string $key Encryption key. * @param int $fmt Optional override for the output encoding. One of FORMAT_RAW, FORMAT_B64 or FORMAT_HEX. * @return string The encrypted string. */ public static function Encrypt( $in, $key, $fmt = null ) { $c = new Cryptor(); return $c->encryptString( $in, $key, $fmt ); } /** * Static convenience method for decrypting. * @param string $in String to decrypt. * @param string $key Decryption key. * @param int $fmt Optional override for the input encoding. One of FORMAT_RAW, FORMAT_B64 or FORMAT_HEX. * @return string The decrypted string. */ public static function Decrypt( $in, $key, $fmt = null ) { $c = new Cryptor(); return $c->decryptString( $in, $key, $fmt ); } } PK 4T1]�9�qV V class-easywpsmtp-utils.phpnu ��� <?php use ioncube\phpOpensslCryptor\Cryptor; class EasyWPSMTP_Utils { public $enc_key; protected static $instance = null; public function __construct($addon=null) { require_once EasyWPSMTP::get_instance()->plugin_path . '/inc/deprecated/Cryptor.php'; $this->enc_key = ''; $this->addon = $addon; } public static function get_instance() { // If the single instance hasn't been set, set it now. if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } public static function base64_decode_maybe( $str ) { if ( ! function_exists( 'mb_detect_encoding' ) ) { return base64_decode( $str ); //phpcs:ignore } if ( mb_detect_encoding( $str ) === mb_detect_encoding( base64_decode( base64_encode( base64_decode( $str ) ) ) ) ) { //phpcs:ignore $str = base64_decode( $str ); //phpcs:ignore } return $str; } public function encrypt_password( $password ) { if ( empty( $password ) ) { return ''; } $key = get_option( 'swpsmtp_enc_key', false ); if ( empty( $key ) ) { $key = wp_salt(); update_option( 'swpsmtp_enc_key', $key, false ); } try { $password = Cryptor::Encrypt( $password, $key ); } catch ( Exception $e ) {} return $password; } public function decrypt_password( $password ) { $key = get_option( 'swpsmtp_enc_key', false ); try { $password = Cryptor::Decrypt( $password, $key ); } catch ( Exception $e ) {} return $password; } /** * Sanitizes textarea. Tries to use wp sanitize_textarea_field() function. If that's not available, uses its own methods * @return string */ public static function sanitize_textarea( $str ) { if ( function_exists( 'sanitize_textarea_field' ) ) { return sanitize_textarea_field( $str ); } $filtered = wp_check_invalid_utf8( $str ); if ( strpos( $filtered, '<' ) !== false ) { $filtered = wp_pre_kses_less_than( $filtered ); // This will strip extra whitespace for us. $filtered = wp_strip_all_tags( $filtered, false ); // Use html entities in a special case to make sure no later // newline stripping stage could lead to a functional tag $filtered = str_replace( "<\n", "<\n", $filtered ); } $filtered = trim( $filtered ); $found = false; while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) { $filtered = str_replace( $match[0], '', $filtered ); $found = true; } if ( $found ) { // Strip out the whitespace that may now exist after removing the octets. $filtered = trim( preg_replace( '/ +/', ' ', $filtered ) ); } return $filtered; } public function check_ver() { if ( $this->addon!=null && version_compare( EasyWPSMTP_PLUGIN_VERSION, $this->addon->MIN_EasyWPSMTP_VER ) < 0 ) { add_action( 'admin_notices', array( $this, 'display_min_version_error' ) ); return false; } return true; } public function display_min_version_error() { $class = 'notice notice-error'; // translators: %1$s - plugin name, %2$s - min core plugin version, %3$s - installed core plugin version $message = sprintf( __( '%1$s requires Easy WP SMTP plugin minimum version to be %2$s (you have version %3$s installed). Please update Easy WP SMTP plugin.', 'easy-wp-smtp' ), $this->addon->ADDON_FULL_NAME, $this->addon->MIN_EasyWPSMTP_VER, EasyWPSMTP_PLUGIN_VERSION ); printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); } } PK 4T1]956zL zL class-easywpsmtp.phpnu ��� <?php use EasyWPSMTP\Helpers\Helpers; use EasyWPSMTP\Migrations\DeprecatedOptionsMigration; use EasyWPSMTP\Options; use PHPMailer\PHPMailer\PHPMailer; class EasyWPSMTP { public $opts; public $plugin_file; public $plugin_url; public $plugin_path; protected static $instance = null; public static $reset_log_str = "Easy WP SMTP debug log file\r\n\r\n"; public function __construct() { $this->opts = []; $this->plugin_file = EasyWPSMTP_PLUGIN_FILE; $this->plugin_url = rtrim( plugin_dir_url( $this->plugin_file ), '/\\' ); $this->plugin_path = rtrim( plugin_dir_path( $this->plugin_file ), '/\\' ); require_once $this->plugin_path . '/inc/deprecated/functions.php'; require_once $this->plugin_path . '/inc/deprecated/class-easywpsmtp-utils.php'; if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { require_once $this->plugin_path . '/inc/deprecated/class-easywpsmtp-admin.php'; } add_action( 'plugins_loaded', [ $this, 'init' ] ); } public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } public function init() { if ( Options::init()->get( 'deprecated', 'debug_log_enabled' ) ) { add_filter( 'wp_mail', array( $this, 'wp_mail' ), 2147483647 ); add_action( 'wp_mail_failed', array( $this, 'wp_mail_failed' ) ); add_action( 'admin_init', array( $this, 'admin_init' ) ); } } public function wp_mail( $args ) { $options = Options::init(); $is_domain_blocked = Helpers::is_domain_blocked(); //Check if the "to" field has multiple emails in an array. $to_address = ""; if ( ! empty( $args['to'] ) ) { $to_address = is_array( $args['to'] ) ? implode( ' ; ', $args['to'] ) : $args['to']; } if ( $is_domain_blocked && $options->get( 'general', 'domain_check_do_not_send' ) ) { $domain = wp_parse_url( get_site_url(), PHP_URL_HOST ); $this->log( "\r\n------------------------------------------------------------------------------------------------------\r\n" . 'Domain check failed: website domain (' . $domain . ") is not in allowed domains list.\r\n" . "Following email not sent (block all emails option is enabled):\r\n" . 'To: ' . $to_address . '; Subject: ' . $args['subject'] . "\r\n" . "------------------------------------------------------------------------------------------------------\r\n\r\n" ); } else if( $options->get( 'deprecated', 'debug_log_enabled' ) ) { //Prepare the debug logging line $line = sprintf( 'Headers: %s, To: %s, Subject: %s', ! empty( $args['headers'] && is_array( $args['headers'] ) ) ? implode( ' | ', $args['headers'] ) : '', ! empty( $args['to'] ) ? $to_address : '', ! empty( $args['subject'] ) ? $args['subject'] : '' ); $this->log( $line . "\r\n" ); } if ( $is_domain_blocked && ! $options->get( 'general', 'domain_check_do_not_send' ) ) { $domain = wp_parse_url( get_site_url(), PHP_URL_HOST ); $this->log( "\r\n------------------------------------------------------------------------------------------------------\r\n" . 'Domain check failed: website domain (' . $domain . ") is not in allowed domains list.\r\n" . "SMTP settings won't be used.\r\n" . "------------------------------------------------------------------------------------------------------\r\n\r\n" ); } return $args; } public function wp_mail_failed( $wp_error ) { if ( ! empty( $wp_error->errors ) && ! empty( $wp_error->errors['wp_mail_failed'] ) && is_array( $wp_error->errors['wp_mail_failed'] ) ) { $this->log( '*** ' . implode( ' | ', $wp_error->errors['wp_mail_failed'] ) . " ***\r\n" ); } } public function init_smtp( &$phpmailer ) { //check if SMTP credentials have been configured. if ( ! $this->credentials_configured() ) { return; } //check if Domain Check enabled $domain = $this->is_domain_blocked(); if ( false !== $domain ) { //domain check failed //let's check if we have block all emails option enabled if ( isset( $this->opts['block_all_emails'] ) && 1 === $this->opts['block_all_emails'] ) { // it's enabled. Let's use gag mailer class that would prevent emails from being sent out. require_once $this->plugin_path . '/inc/deprecated/class-easywpsmtp-gag-mailer.php'; $phpmailer = new EasyWPSMTP_Gag_Mailer(); } return; } /* Set the mailer type as per config above, this overrides the already called isMail method */ $phpmailer->IsSMTP(); if ( isset( $this->opts['force_from_name_replace'] ) && 1 === $this->opts['force_from_name_replace'] ) { $from_name = $this->opts['from_name_field']; } else { $from_name = ! empty( $phpmailer->FromName ) ? $phpmailer->FromName : $this->opts['from_name_field']; } $from_email = $this->opts['from_email_field']; //set ReplyTo option if needed //this should be set before SetFrom, otherwise might be ignored if ( ! empty( $this->opts['reply_to_email'] ) ) { if ( isset( $this->opts['sub_mode'] ) && 1 === $this->opts['sub_mode'] ) { if ( count( $phpmailer->getReplyToAddresses() ) >= 1 ) { // Substitute from_email_field with reply_to_email if ( array_key_exists( $this->opts['from_email_field'], $phpmailer->getReplyToAddresses() ) ) { $reply_to_emails = $phpmailer->getReplyToAddresses(); unset( $reply_to_emails[ $this->opts['from_email_field'] ] ); $phpmailer->clearReplyTos(); foreach ( $reply_to_emails as $reply_to_email => $reply_to_name ) { $phpmailer->AddReplyTo( $reply_to_email, $reply_to_name ); } $phpmailer->AddReplyTo( $this->opts['reply_to_email'], $from_name ); } } else { // Reply-to array is empty so add reply_to_email $phpmailer->AddReplyTo( $this->opts['reply_to_email'], $from_name ); } } else { // Default behaviour $phpmailer->AddReplyTo( $this->opts['reply_to_email'], $from_name ); } } if ( ! empty( $this->opts['bcc_email'] ) ) { $bcc_emails = explode( ',', $this->opts['bcc_email'] ); foreach ( $bcc_emails as $bcc_email ) { $bcc_email = trim( $bcc_email ); $phpmailer->AddBcc( $bcc_email ); } } // let's see if we have email ignore list populated if ( isset( $this->opts['email_ignore_list'] ) && ! empty( $this->opts['email_ignore_list'] ) ) { $emails_arr = explode( ',', $this->opts['email_ignore_list'] ); $from = $phpmailer->From; $match_found = false; foreach ( $emails_arr as $email ) { if ( strtolower( trim( $email ) ) === strtolower( trim( $from ) ) ) { $match_found = true; break; } } if ( $match_found ) { //we should not override From and Fromname $from_email = $phpmailer->From; $from_name = $phpmailer->FromName; } } $phpmailer->From = $from_email; $phpmailer->FromName = $from_name; $phpmailer->SetFrom( $phpmailer->From, $phpmailer->FromName ); //This should set Return-Path header for servers that are not properly handling it, but needs testing first //$phpmailer->Sender = $phpmailer->From; /* Set the SMTPSecure value */ if ( 'none' !== $this->opts['smtp_settings']['type_encryption'] ) { $phpmailer->SMTPSecure = $this->opts['smtp_settings']['type_encryption']; } /* Set the other options */ $phpmailer->Host = $this->opts['smtp_settings']['host']; $phpmailer->Port = $this->opts['smtp_settings']['port']; /* If we're using smtp auth, set the username & password */ $phpmailer->SMTPAuth = false; if ( 'yes' === $this->opts['smtp_settings']['autentication'] ) { $phpmailer->SMTPAuth = true; $phpmailer->Username = $this->opts['smtp_settings']['username']; $phpmailer->Password = $this->get_password(); } //PHPMailer 5.2.10 introduced this option. However, this might cause issues if the server is advertising TLS with an invalid certificate. $phpmailer->SMTPAutoTLS = false; if ( isset( $this->opts['smtp_settings']['insecure_ssl'] ) && false !== $this->opts['smtp_settings']['insecure_ssl'] ) { // Insecure SSL option enabled $phpmailer->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ), ); } //set reasonable timeout $phpmailer->Timeout = 10; } public function test_mail( $to_email, $subject, $message ) { $ret = array(); if ( ! $this->credentials_configured() ) { return false; } global $wp_version; if ( version_compare( $wp_version, '5.4.99' ) > 0 ) { require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php'; require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php'; require_once ABSPATH . WPINC . '/PHPMailer/Exception.php'; $mail = new PHPMailer( true ); } else { require_once ABSPATH . WPINC . '/class-phpmailer.php'; $mail = new \PHPMailer( true ); } try { $charset = get_bloginfo( 'charset' ); $mail->CharSet = $charset; $from_name = $this->opts['from_name_field']; $from_email = $this->opts['from_email_field']; $mail->IsSMTP(); // send plain text test email $mail->ContentType = 'text/plain'; $mail->IsHTML( false ); /* If using smtp auth, set the username & password */ if ( 'yes' === $this->opts['smtp_settings']['autentication'] ) { $mail->SMTPAuth = true; $mail->Username = $this->opts['smtp_settings']['username']; $mail->Password = $this->get_password(); } /* Set the SMTPSecure value, if set to none, leave this blank */ if ( 'none' !== $this->opts['smtp_settings']['type_encryption'] ) { $mail->SMTPSecure = $this->opts['smtp_settings']['type_encryption']; } /* PHPMailer 5.2.10 introduced this option. However, this might cause issues if the server is advertising TLS with an invalid certificate. */ $mail->SMTPAutoTLS = false; if ( isset( $this->opts['smtp_settings']['insecure_ssl'] ) && false !== $this->opts['smtp_settings']['insecure_ssl'] ) { // Insecure SSL option enabled $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ), ); } /* Set the other options */ $mail->Host = $this->opts['smtp_settings']['host']; $mail->Port = $this->opts['smtp_settings']['port']; //Add reply-to if set in settings. if ( ! empty( $this->opts['reply_to_email'] ) ) { $mail->AddReplyTo( $this->opts['reply_to_email'], $from_name ); } //Add BCC if set in settings. if ( ! empty( $this->opts['bcc_email'] ) ) { $bcc_emails = explode( ',', $this->opts['bcc_email'] ); foreach ( $bcc_emails as $bcc_email ) { $bcc_email = trim( $bcc_email ); $mail->AddBcc( $bcc_email ); } } $mail->SetFrom( $from_email, $from_name ); //This should set Return-Path header for servers that are not properly handling it, but needs testing first //$mail->Sender = $mail->From; $mail->Subject = $subject; $mail->Body = $message; $mail->AddAddress( $to_email ); global $debug_msg; $debug_msg = ''; $mail->Debugoutput = function ( $str, $level ) { global $debug_msg; $debug_msg .= $str; }; $mail->SMTPDebug = 1; //set reasonable timeout $mail->Timeout = 10; /* Send mail and return result */ $mail->Send(); $mail->ClearAddresses(); $mail->ClearAllRecipients(); } catch ( \Exception $e ) { $ret['error'] = $mail->ErrorInfo; } catch ( \Throwable $e ) { $ret['error'] = $mail->ErrorInfo; } $ret['debug_log'] = $debug_msg; return $ret; } public function admin_init() { if ( current_user_can( 'manage_options' ) ) { if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { add_action( 'wp_ajax_swpsmtp_clear_log', array( $this, 'clear_log' ) ); } //view log file if ( isset( $_GET['swpsmtp_action'] ) ) { $options = Options::init(); if ( 'view_log' === $_GET['swpsmtp_action'] ) { $log_file_root_path = $this->get_log_file_root_path(); $log_file_name = $options->get('deprecated', 'debug_log_file_name'); if ( empty( $log_file_name ) ) { //Nothing in the log file yet so nothing to show. wp_die( 'Nothing in the log file yet.' ); } if ( ! file_exists( $log_file_root_path . $log_file_name ) ) { if ( $this->log( self::$reset_log_str ) === false ) { wp_die( esc_html( sprintf( 'Can\'t write to log file. Check if plugin directory (%s) is writeable.', $log_file_root_path ) ) ); }; } $logfile = fopen( $log_file_root_path . $log_file_name, 'rb' ); //phpcs:ignore if ( ! $logfile ) { wp_die( 'Can\'t open log file.' ); } header( 'Content-Type: text/plain' ); fpassthru( $logfile ); die; } } } } public function admin_notices() { if ( ! $this->credentials_configured() ) { $settings_url = admin_url() . 'options-general.php?page=swpsmtp_settings'; ?> <div class="error"> <p> <?php // translators: %s URL to the plugin's settings page. printf( __( 'Please configure your SMTP credentials in the <a href="%s">settings menu</a> in order to send email using Easy WP SMTP plugin.', 'easy-wp-smtp' ), esc_url( $settings_url ) ); ?> </p> </div> <?php } } public function get_log_file_path() { $log_file_name = 'logs' . DIRECTORY_SEPARATOR . '.' . uniqid( '', true ) . '.txt'; $log_file_name = apply_filters( 'swpsmtp_log_file_path_override', $log_file_name ); return $log_file_name; } private function get_log_file_root_path() { return apply_filters( 'easy_wp_mail_get_log_file_root_path', $this->plugin_path . '/' ); } public function clear_log() { if ( ! check_ajax_referer( 'easy-wp-smtp-admin', 'nonce', false ) ) { echo esc_html( __( 'Nonce check failed.', 'easy-wp-smtp' ) ); exit; }; if ( $this->log( self::$reset_log_str, true ) !== false ) { echo '1'; } else { echo esc_html( __( "Can't clear log - file is not writeable.", 'easy-wp-smtp' ) ); } die; } public function log( $str, $overwrite = false ) { // Skip logging if deprecated options migration was not performed to prevent `easy_wp_smtp` option creation in DB. if ( DeprecatedOptionsMigration::get_current_version() < 1 ) { return true; } try { $options = Options::init(); $log_file_root_path = $this->get_log_file_root_path(); $log_file_name = ''; if ( ! empty( $options->get( 'deprecated', 'debug_log_file_name' ) ) ) { $log_file_name = $options->get( 'deprecated', 'debug_log_file_name' ); } if ( empty( $log_file_name ) || $overwrite ) { if ( ! empty( $log_file_name ) && file_exists( $log_file_root_path . $log_file_name ) ) { unlink( $log_file_root_path . $log_file_name ); } $log_file_name = $this->get_log_file_path(); $options->set( [ 'deprecated' => [ 'debug_log_file_name' => $log_file_name ] ], false, false ); file_put_contents( $log_file_root_path . $log_file_name, self::$reset_log_str ); //phpcs:ignore } //Timestamp the log output $str = '[' . date( 'm/d/Y g:i:s A' ) . '] - ' . $str; //Write to the log file return ( file_put_contents( $log_file_root_path . $log_file_name, $str, ( ! $overwrite ? FILE_APPEND : 0 ) ) ); //phpcs:ignore } catch ( \Exception $e ) { return false; } } public function plugin_action_links( $links, $file ) { if ( plugin_basename( $this->plugin_file ) === $file ) { $settings_link = '<a href="options-general.php?page=swpsmtp_settings">' . __( 'Settings', 'easy-wp-smtp' ) . '</a>'; array_unshift( $links, $settings_link ); } return $links; } public function register_plugin_links( $links, $file ) { if ( plugin_basename( $this->plugin_file ) === $file ) { $links[] = '<a href="options-general.php?page=swpsmtp_settings">' . __( 'Settings', 'easy-wp-smtp' ) . '</a>'; } return $links; } public function plugins_loaded_handler() { load_plugin_textdomain( 'easy-wp-smtp', false, dirname( plugin_basename( $this->plugin_file ) ) . '/languages/' ); } public function is_domain_blocked() { return Helpers::is_domain_blocked(); } public function get_password() { return Options::init()->get( 'smtp', 'pass' ); } public function encrypt_password( $pass ) { if ( '' === $pass ) { return ''; } return $this->get_password(); } public function credentials_configured() { $credentials_configured = true; if ( empty( Options::init()->get( 'mail', 'from_email' ) ) ) { $credentials_configured = false; } if ( empty( Options::init()->get( 'mail', 'from_name' ) ) ) { $credentials_configured = false; } return $credentials_configured; } public function activate() { $swpsmtp_options_default = array( 'from_email_field' => '', 'from_name_field' => '', 'force_from_name_replace' => 0, 'sub_mode' => 0, 'smtp_settings' => array( 'host' => 'smtp.example.com', 'type_encryption' => 'none', 'port' => 25, 'autentication' => 'yes', 'username' => '', 'password' => '', ), ); /* install the default plugin options if needed */ if ( empty( $this->opts ) ) { $this->opts = $swpsmtp_options_default; } $this->opts = array_merge( $swpsmtp_options_default, $this->opts ); // reset log file $this->log( self::$reset_log_str, true ); update_option( 'swpsmtp_options', $this->opts, 'yes' ); //add current domain to allowed domains list if ( ! isset( $this->opts['allowed_domains'] ) ) { //TODO: Change parse_url() to wp_parse_url() and bump required WP version to 4.4.0 $domain = parse_url( get_site_url(), PHP_URL_HOST ); //phpcs:ignore if ( $domain ) { $this->opts['allowed_domains'] = base64_encode( $domain ); //phpcs:ignore update_option( 'swpsmtp_options', $this->opts ); } } else { // let's check if existing value should be base64 encoded if ( ! empty( $this->opts['allowed_domains'] ) ) { if ( EasyWPSMTP_Utils::base64_decode_maybe( $this->opts['allowed_domains'] ) === $this->opts['allowed_domains'] ) { $this->opts['allowed_domains'] = base64_encode( $this->opts['allowed_domains'] ); //phpcs:ignore update_option( 'swpsmtp_options', $this->opts ); } } } // Encrypt password if needed if ( ! get_option( 'swpsmtp_pass_encrypted' ) ) { if ( extension_loaded( 'openssl' ) ) { if ( '' !== $this->opts['smtp_settings']['password'] ) { $this->opts['smtp_settings']['password'] = $this->encrypt_password( $this->get_password() ); update_option( 'swpsmtp_options', $this->opts ); } } } } public function deactivate() { // reset log file $this->log( self::$reset_log_str, true ); } public function self_destruct_handler() { $err_msg = __( 'Please refresh the page and try again.', 'easy-wp-smtp' ); $trans = get_transient( 'easy_wp_smtp_sd_code' ); if ( empty( $trans ) ) { echo esc_html( $err_msg ); exit; } $sd_code = isset( $_POST['sd_code'] ) ? sanitize_text_field( stripslashes ( $_POST['sd_code'] ) ) : ''; if ( $trans !== $sd_code ) { echo esc_html( $err_msg ); exit; } $this->log( self::$reset_log_str, true ); delete_site_option( 'swpsmtp_options' ); delete_option( 'swpsmtp_options' ); delete_site_option( 'smtp_test_mail' ); delete_option( 'smtp_test_mail' ); delete_site_option( 'swpsmtp_pass_encrypted' ); delete_option( 'swpsmtp_pass_encrypted' ); delete_option( 'swpsmtp_enc_key' ); echo 1; deactivate_plugins( __FILE__ ); exit; } } // Init. EasyWPSMTP::get_instance(); PK 4T1]��t t class-easywpsmtp-gag-mailer.phpnu ��� PK 4T1]HH�� � functions.phpnu ��� PK 4T1]ixcG� G� class-easywpsmtp-admin.phpnu ��� PK 4T1]�mK K �� Cryptor.phpnu ��� PK 4T1]�9�qV V � class-easywpsmtp-utils.phpnu ��� PK 4T1]956zL zL �� class-easywpsmtp.phpnu ��� PK � w�
| ver. 1.6 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка