Skip to content

Commit

Permalink
v2.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Jan 9, 2024
1 parent 042aee6 commit dbe0a04
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 120 deletions.
8 changes: 4 additions & 4 deletions email-verification-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Plugin Name: Email Verification for WooCommerce
Plugin URI: https://wpfactory.com/item/email-verification-for-woocommerce/
Description: Verify user emails in WooCommerce. Beautifully.
Version: 2.6.3
Version: 2.6.5
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: emails-verification-for-woocommerce
Domain Path: /langs
Copyright: © 2023 WPFactory
WC tested up to: 8.3
Copyright: © 2024 WPFactory
WC tested up to: 8.4
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
Expand Down Expand Up @@ -62,7 +62,7 @@ final class Alg_WC_Email_Verification {
* @var string
* @since 1.0.0
*/
public $version = '2.6.3';
public $version = '2.6.5';

/**
* @var Alg_WC_Email_Verification The single instance of the class
Expand Down
21 changes: 20 additions & 1 deletion includes/alg-wc-ev-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Functions.
*
* @version 2.6.0
* @version 2.6.5
* @since 1.9.0
* @author WPFactory
*/
Expand Down Expand Up @@ -179,6 +179,25 @@ function alg_wc_ev_get_user_placeholders( $args ) {
}
}

if ( ! function_exists( 'alg_wc_ev_get_common_placeholders' ) ) {
/**
* alg_wc_ev_get_common_placeholders.
*
* @version 2.6.5
* @since 2.6.5
*
* @return array
*/
function alg_wc_ev_get_common_placeholders() {
$placeholders = array(
'%site_title%' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
'%site_url%' => wp_parse_url( home_url(), PHP_URL_HOST )
);

return apply_filters( 'alg_wc_ev_common_placeholders', $placeholders );
}
}

if ( ! function_exists( 'alg_wc_ev_get_default_session_start_params' ) ) {
/**
* alg_wc_ev_get_session_start_default_params.
Expand Down
22 changes: 18 additions & 4 deletions includes/class-alg-wc-ev-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Core Class.
*
* @version 2.6.2
* @version 2.6.4
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -1134,7 +1134,7 @@ function get_default_hashids_salt_opt() {
/**
* add_this_script_footer.
*
* @version 2.6.0
* @version 2.6.4
* @since 2.5.8
*
* @return string
Expand All @@ -1144,6 +1144,7 @@ function add_this_script_footer() {
<script>
jQuery(function ($) {
var billing_email_input = $('input[name="billing_email"]');


<?php
if ( is_checkout() && ! is_wc_endpoint_url() ) {
Expand All @@ -1170,12 +1171,21 @@ function add_this_script_footer() {

var current_billing_email = billing_email_input.val();
var billing_email_paragraph = $('p[id="billing_email_field"]');
billing_email_paragraph.append('<div id="alg_wc_ev_activation_guest_verify"></div>');
billing_email_paragraph.append('<div id="alg_wc_ev_activation_guest_verify"></div>');

var guest_email_verify_text = $('div[id="alg_wc_ev_activation_guest_verify"]');


var resend_email_verify = $('a[id="alg_wc_ev_resend_verify"]');
send_alg_wc_ev_guest_verification_email("new", current_billing_email);
billing_email_input.on('input change paste keyup blur', function () {
send_alg_wc_ev_guest_verification_email("new", $(this).val());
// send_alg_wc_ev_guest_verification_email("new", $(this).val());
guest_email_verify_text.html('');
var regexo = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var isValido = regexo.test($(this).val());
if (isValido) {
guest_email_verify_text.html('<a href="javascript:;" id="alg_wc_ev_send_verify">Send Verify Email</a>');
}
});


Expand Down Expand Up @@ -1221,6 +1231,10 @@ function send_alg_wc_ev_guest_verification_email(send, email) {

$("body").on("click", "#alg_wc_ev_resend_verify", function () {
send_alg_wc_ev_guest_verification_email("resend", $('input[name="billing_email"]').val());
});

$("body").on("click", "#alg_wc_ev_send_verify", function () {
send_alg_wc_ev_guest_verification_email("new", $('input[name="billing_email"]').val());
});
});
</script>
Expand Down
12 changes: 6 additions & 6 deletions includes/class-alg-wc-ev-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ function get_verification_url( $args = null, $checkout = false ) {
/**
* get_email_subject.
*
* @version 2.3.1
* @version 2.6.5
* @since 2.3.1
*/
function get_email_subject( $args ) {
$args = wp_parse_args( $args, array(
'user_id' => '',
'subject' => '',
'context' => 'activation_email_separate',
'placeholders' => array()
'placeholders' => alg_wc_ev_get_common_placeholders()
) );
$user_id = $args['user_id'];
$placeholders = array_merge( $args['placeholders'], alg_wc_ev_get_user_placeholders( array( 'user_id' => $user_id ) ) );
Expand All @@ -268,7 +268,7 @@ function get_email_subject( $args ) {
/**
* get_email_content.
*
* @version 2.4.0
* @version 2.6.5
* @since 1.8.0
* @todo (maybe) `$user->user_url`, `$user->user_registered`
*
Expand All @@ -283,7 +283,7 @@ function get_email_content( $args = null ) {
'content' => __( '<p>Please <a href="%verification_url%" target="_blank">click here</a> to verify your email.</p>', 'emails-verification-for-woocommerce' ),
'heading' => __( 'Activate your account', 'emails-verification-for-woocommerce' ),
'context' => 'activation_email_separate',
'placeholders' => array()
'placeholders' => alg_wc_ev_get_common_placeholders()
) );
$user_id = $args['user_id'];
$code = $args['code'];
Expand Down Expand Up @@ -497,8 +497,8 @@ function send_mail( $to, $subject, $message ) {
* `wc_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = '' )`
* `wp_mail( string|array $to, string $subject, string $message, string|array $headers = '', string|array $attachments = array() )`
*/
$func = get_option( 'alg_wc_ev_mail_function', 'wc_mail' );
$message = apply_filters( 'alg_wc_ev_send_mail_message', $message, $func );
$func = get_option( 'alg_wc_ev_mail_function', 'wc_mail' );
$message = apply_filters( 'alg_wc_ev_send_mail_message', $message, $func );
$res = $func( $to, $subject, $message, "Content-Type: text/html\r\n" );
if ( ! $res ) {
$error_message = __( 'Error sending mail.', 'emails-verification-for-woocommerce' );
Expand Down
13 changes: 11 additions & 2 deletions includes/settings/class-alg-wc-ev-settings-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Email Section Settings.
*
* @version 2.4.8
* @version 2.6.5
* @since 1.3.0
* @author WPFactory
*/
Expand Down Expand Up @@ -35,6 +35,8 @@ function __construct() {
*/
function get_default_email_placeholders(){
return array(
'%site_title%',
'%site_url%',
'%user_id%',
'%user_login%',
'%user_nicename%',
Expand All @@ -52,7 +54,7 @@ function get_default_email_placeholders(){
/**
* get_settings.
*
* @version 2.4.8
* @version 2.6.5
* @since 1.3.0
*/
function get_settings() {
Expand Down Expand Up @@ -180,6 +182,8 @@ function get_settings() {
array(
'title' => __( 'Email content', 'emails-verification-for-woocommerce' ),
'desc' => sprintf( __( 'Placeholders: %s', 'emails-verification-for-woocommerce' ), '<code>' . implode( '</code>, <code>', array(
'%site_title%',
'%site_url%',
'%verification_url%',
'%user_id%',
'%user_first_name%',
Expand All @@ -189,6 +193,7 @@ function get_settings() {
'%user_email%',
'%user_display_name%',
) ) . '</code>' ),
'desc_tip' => sprintf( __( 'If you\'re having deliverability problems or emails being sent to Spam, please try using the placeholders %s and %s on the Email Content or subject.', 'emails-verification-for-woocommerce' ), '<code>%site_title%</code>','<code>%site_url%</code>'),
'type' => 'textarea',
'id' => 'alg_wc_ev_email_content',
'default' => __( '<p>Please <a href="%verification_url%" target="_blank">click here</a> to verify your email.</p>', 'emails-verification-for-woocommerce' ),
Expand Down Expand Up @@ -265,6 +270,8 @@ function get_settings() {
array(
'title' => __( 'Email content', 'emails-verification-for-woocommerce' ),
'desc' => sprintf( __( 'Placeholders: %s', 'emails-verification-for-woocommerce' ), '<code>' . implode( '</code>, <code>', array(
'%site_title%',
'%site_url%',
'%user_id%',
'%user_first_name%',
'%user_last_name%',
Expand All @@ -273,6 +280,7 @@ function get_settings() {
'%user_email%',
'%user_display_name%',
) ) . '</code>' ),
'desc_tip' => sprintf( __( 'If you\'re having deliverability problems or emails being sent to Spam, please try using the placeholders %s and %s on the Email Content or subject.', 'emails-verification-for-woocommerce' ), '<code>%site_title%</code>','<code>%site_url%</code>'),
'type' => 'textarea',
'id' => 'alg_wc_ev_confirmation_email_content',
'default' => __( '<p>Your account has been activated successfully.</p>', 'emails-verification-for-woocommerce' ),
Expand Down Expand Up @@ -363,6 +371,7 @@ function get_settings() {
array(
'title' => __( 'Content', 'emails-verification-for-woocommerce' ),
'desc' => $this->available_placeholders_desc( $this->get_default_email_placeholders() ),
'desc_tip' => sprintf( __( 'If you\'re having deliverability problems or emails being sent to Spam, please try using the placeholders %s and %s on the Email Content content or subject.', 'emails-verification-for-woocommerce' ), '<code>%site_title%</code>','<code>%site_url%</code>'),
'type' => 'textarea',
'id' => 'alg_wc_ev_admin_email_content',
'default' => sprintf( __( 'User %s has just verified his email (%s).', 'emails-verification-for-woocommerce' ),
Expand Down
Loading

0 comments on commit dbe0a04

Please sign in to comment.