Changeset 2680885
- Timestamp:
- 02/17/2022 02:24:17 PM (4 years ago)
- Location:
- woorule
- Files:
-
- 18 edited
- 1 copied
-
tags/2.7.0 (copied) (copied from woorule/trunk)
-
tags/2.7.0/README.txt (modified) (3 diffs)
-
tags/2.7.0/assets/woorule.js (modified) (3 diffs)
-
tags/2.7.0/inc/class-rulemailer-api.php (modified) (3 diffs)
-
tags/2.7.0/inc/class-woorule-cart-hooks.php (modified) (2 diffs)
-
tags/2.7.0/inc/class-woorule-order-hooks.php (modified) (1 diff)
-
tags/2.7.0/inc/class-woorule-shortcode.php (modified) (3 diffs)
-
tags/2.7.0/inc/partials/shortcode-woorule.php (modified) (1 diff)
-
tags/2.7.0/languages/woorule.pot (modified) (2 diffs)
-
tags/2.7.0/woorule.php (modified) (2 diffs)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/assets/woorule.js (modified) (3 diffs)
-
trunk/inc/class-rulemailer-api.php (modified) (3 diffs)
-
trunk/inc/class-woorule-cart-hooks.php (modified) (2 diffs)
-
trunk/inc/class-woorule-order-hooks.php (modified) (1 diff)
-
trunk/inc/class-woorule-shortcode.php (modified) (3 diffs)
-
trunk/inc/partials/shortcode-woorule.php (modified) (1 diff)
-
trunk/languages/woorule.pot (modified) (2 diffs)
-
trunk/woorule.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woorule/tags/2.7.0/README.txt
r2671567 r2680885 3 3 Tags: rule, woocommerce, newsletter, marketing 4 4 Requires at least: 5.0.0 5 Tested up to: 5. 8.35 Tested up to: 5.9 6 6 Requires PHP: 5.6+ 7 Stable tag: 2. 6.07 Stable tag: 2.7.0 8 8 License: MIT 9 9 License URI: http://opensource.org/licenses/MIT … … 41 41 You can embed a Newsletter sign-up form in your posts, or on any page with a simple shortcode `[woorule]` 42 42 43 You can also customize the sign-up form with any of the following shortcode options: 43 You can also customize the sign-up form with any of the following shortcode attributes: 44 44 45 ` 45 [woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" success="Custom Success Message" tag="Custom Tag"]46 [woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" checkbox="Custom Text Next To Checkbox" success="Custom Success Message" tag="Custom Tag" require_opt_in=false] 46 47 ` 47 The `tag` field will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default. 48 49 The `checkbox` attribute will add a checkbox below the signup form. If this attribute is present then checking the checkbox is required before the form can be submitted. This is useful for ensuring the subscriber agrees to your terms before being added to a mailing list. 50 51 The `tag` attribute will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default. 52 53 The `require_opt_in` attribute, if set to `true`, will require the subscriber to accept an opt-in email before further marketing emails can be sent. The opt-in flow requires you to have a [subscriber form](https://app.rule.io/#/subscriber/subscriber-form) setup in your Rule account in order for the opt-in email to be sent to the subscriber. Note that the `tag` attribute should be the same as the form tag. 54 48 55 49 56 == Frequently Asked Questions == … … 101 108 102 109 For more information, check out our [releases](https://github.com/rulecom/woorule/releases). 110 111 = 2.7.0 = 112 * Added an optional `checkbox` attribute to the woorule shortcode, which must be checked before the form can be submitted 113 * Added an optional `require_opt_in` attribute to the woorule shortcode, which sends the subscriber an opt-in email before they can received additional marketing emails 114 * Fixed Cart In Progress bug 115 * Improved logging 103 116 104 117 = 2.6.0 = -
woorule/tags/2.7.0/assets/woorule.js
r2652963 r2680885 4 4 $('.woorule-subscribe .error').show(); 5 5 } 6 7 $('.woorule-subscribe__checkbox', '.woorule-subscribe').on('change', ({ target }) => { 8 $('input[type="submit"]', '.woorule-subscribe form').prop('disabled', !target.checked) 9 }) 6 10 7 11 $('.woorule-subscribe form').submit(function (e) { … … 11 15 let email = $('.woorule-subscribe #semail').val(); 12 16 let tags = $('.woorule-subscribe .tag').val(); 17 const requireOptIn = $('.woorule-subscribe [name="require-opt-in"]').val(); 13 18 14 19 if ((!email) || (email.length < 4)) { … … 28 33 nonce: ajax_var.nonce, 29 34 email, 30 tags 35 tags, 36 requireOptIn 31 37 }, 32 38 success(data) { -
woorule/tags/2.7.0/inc/class-rulemailer-api.php
r2665748 r2680885 38 38 static::log( 'Error: ' . $resp->get_error_message() ); 39 39 } else { 40 static::log( 'Subscribe Success: ' . print_r( $resp['body'], true ) ); 41 static::log( 'Subscribe Success: ' . print_r( $body_data, true ) ); 40 $resp = json_decode( wp_remote_retrieve_body( $resp ), true ); 41 if ( isset( $resp['error'] ) ) { 42 static::log( 'Error: ' . wc_print_r( $resp, true ) ); 43 static::log( 'Error: ' . wc_print_r( $body_data, true ) ); 44 } else { 45 static::log( 'Subscribe Success: ' . wc_print_r( $resp, true ) ); 46 static::log( 'Subscribe Success: ' . wc_print_r( $body_data, true ) ); 47 } 42 48 } 43 49 } … … 63 69 static::log( 'Error delete subscriber tag: ' . $resp->get_error_message() ); 64 70 } else { 65 static::log( 'Subscriber tag deleted successfully: ' . print_r( $resp['body'], true ) ); 71 $resp = json_decode( wp_remote_retrieve_body( $resp ), true ); 72 if ( isset( $resp['error'] ) ) { 73 static::log( 'Error: ' . wc_print_r( $resp, true ) ); 74 static::log( 'Error: ' . wc_print_r( compact( 'email', 'tag' ), true ) ); 75 } else { 76 static::log( 'Subscriber tag deleted successfully: ' . wc_print_r( $resp, true ) ); 77 } 66 78 } 67 79 } … … 79 91 80 92 if ( is_array( $msg ) || is_object( $msg ) ) { 81 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r 82 $logger->add( 'woorule', print_r( $msg, true ) ); 93 $logger->add( 'woorule', wc_print_r( $msg, true ) ); 83 94 } else { 84 95 $logger->add( 'woorule', $msg ); -
woorule/tags/2.7.0/inc/class-woorule-cart-hooks.php
r2671567 r2680885 83 83 if ( ! $this->retrieve_current_customer() ) { 84 84 return; 85 } 86 87 $email = $this->current_customer->get_billing_email(); 88 if ( empty( $email ) ) { 89 $email = $this->current_customer->get_email(); 85 90 } 86 91 … … 98 103 'tags' => $this->get_subscription_tags(), 99 104 'subscribers' => array( 100 'email' => $ this->current_customer->get_billing_email(),105 'email' => $email, 101 106 'phone_number' => $this->current_customer->get_billing_phone(), 102 107 'language' => substr( get_locale(), 0, 2 ), -
woorule/tags/2.7.0/inc/class-woorule-order-hooks.php
r2671567 r2680885 71 71 RuleMailer_API::subscribe( $subscription ); 72 72 73 if ( $order->meta_exists( '_cart_in_progress_deleted' ) ) {73 if ( ! $order->meta_exists( '_cart_in_progress_deleted' ) ) { 74 74 RuleMailer_API::delete_subscriber_tag( $order->get_billing_email(), 'CartInProgress' ); 75 $order->add_meta_data( '_cart_in_progress_deleted', true );75 $order->add_meta_data( '_cart_in_progress_deleted', true, true ); 76 76 $order->save(); 77 77 } -
woorule/tags/2.7.0/inc/class-woorule-shortcode.php
r2671567 r2680885 78 78 'error' => __( 'Oops, something is wrong..', 'woorule' ), 79 79 'tag' => '', 80 'checkbox' => '', 81 'require_opt_in' => false, 80 82 ), 81 83 $atts, … … 122 124 } 123 125 126 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash 127 $require_opt_in = filter_var( $_POST['requireOptIn'], FILTER_VALIDATE_BOOLEAN ); 128 124 129 $subscription = array( 125 130 'apikey' => Woorule_Options::get_api_key(), … … 132 137 'email' => $email, 133 138 ), 139 'require_opt_in' => $require_opt_in, 134 140 ); 135 141 -
woorule/tags/2.7.0/inc/partials/shortcode-woorule.php
r2661379 r2680885 15 15 <label for="semail" class="form_elem"><?php echo esc_html( $args['title'] ); ?></label> 16 16 <input type="text" id="semail" name="email" class="form_elem" placeholder="<?php echo esc_html( $args['placeholder'] ); ?>"/> 17 <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem"/> 17 <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem" 18 <?php disabled( ! empty( $args['checkbox'] ) ); ?> 19 /> 18 20 <input type="hidden" value="<?php echo esc_html( $args['tag'] ); ?>" name="tags" class="tag"/> 21 <input type="hidden" value="<?php echo esc_html( $args['require_opt_in'] ); ?>" name="require-opt-in"/> 19 22 <p class="hidden success"><?php echo esc_html( $args['success'] ); ?></p> 20 23 <p class="hidden error"><?php echo esc_html( $args['error'] ); ?></p> 24 25 <?php if ( $args['checkbox'] ) : ?> 26 <label> 27 <input type="checkbox" class="woorule-subscribe__checkbox"> 28 <?php echo wp_kses_post( $args['checkbox'] ); ?> 29 </label> 30 <?php endif; ?> 21 31 </form> 22 32 </div> -
woorule/tags/2.7.0/languages/woorule.pot
r2671567 r2680885 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WooRule 2. 6.0\n"5 "Project-Id-Version: WooRule 2.7.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woorule\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 12 12 "POT-Creation-Date: 2022-02-02T11:13:33+03:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 6.0\n"14 "X-Generator: WP-CLI 2.7.0\n" 15 15 "X-Domain: woorule\n" 16 16 -
woorule/tags/2.7.0/woorule.php
r2671567 r2680885 9 9 * Plugin URI: http://github.com/rulecom/woorule 10 10 * Description: Rule integration for WooCommerce 11 * Version: 2. 6.011 * Version: 2.7.0 12 12 * Author: Rule 13 13 * Author URI: http://rule.se … … 19 19 */ 20 20 21 define( 'WOORULE_VERSION', '2. 6.0' );21 define( 'WOORULE_VERSION', '2.7.0' ); 22 22 define( 'WOORULE_PATH', plugin_dir_path( __FILE__ ) ); 23 23 define( 'WOORULE_URL', plugin_dir_url( __FILE__ ) ); -
woorule/trunk/README.txt
r2671567 r2680885 3 3 Tags: rule, woocommerce, newsletter, marketing 4 4 Requires at least: 5.0.0 5 Tested up to: 5. 8.35 Tested up to: 5.9 6 6 Requires PHP: 5.6+ 7 Stable tag: 2. 6.07 Stable tag: 2.7.0 8 8 License: MIT 9 9 License URI: http://opensource.org/licenses/MIT … … 41 41 You can embed a Newsletter sign-up form in your posts, or on any page with a simple shortcode `[woorule]` 42 42 43 You can also customize the sign-up form with any of the following shortcode options: 43 You can also customize the sign-up form with any of the following shortcode attributes: 44 44 45 ` 45 [woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" success="Custom Success Message" tag="Custom Tag"]46 [woorule title="Custom Title" placeholder="Custom Placeholder Text" button="Custom Button Text" checkbox="Custom Text Next To Checkbox" success="Custom Success Message" tag="Custom Tag" require_opt_in=false] 46 47 ` 47 The `tag` field will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default. 48 49 The `checkbox` attribute will add a checkbox below the signup form. If this attribute is present then checking the checkbox is required before the form can be submitted. This is useful for ensuring the subscriber agrees to your terms before being added to a mailing list. 50 51 The `tag` attribute will be applied to the subscriber when the form is submitted. If no tag field is used a `Newsletter` tag will be applied by default. 52 53 The `require_opt_in` attribute, if set to `true`, will require the subscriber to accept an opt-in email before further marketing emails can be sent. The opt-in flow requires you to have a [subscriber form](https://app.rule.io/#/subscriber/subscriber-form) setup in your Rule account in order for the opt-in email to be sent to the subscriber. Note that the `tag` attribute should be the same as the form tag. 54 48 55 49 56 == Frequently Asked Questions == … … 101 108 102 109 For more information, check out our [releases](https://github.com/rulecom/woorule/releases). 110 111 = 2.7.0 = 112 * Added an optional `checkbox` attribute to the woorule shortcode, which must be checked before the form can be submitted 113 * Added an optional `require_opt_in` attribute to the woorule shortcode, which sends the subscriber an opt-in email before they can received additional marketing emails 114 * Fixed Cart In Progress bug 115 * Improved logging 103 116 104 117 = 2.6.0 = -
woorule/trunk/assets/woorule.js
r2652963 r2680885 4 4 $('.woorule-subscribe .error').show(); 5 5 } 6 7 $('.woorule-subscribe__checkbox', '.woorule-subscribe').on('change', ({ target }) => { 8 $('input[type="submit"]', '.woorule-subscribe form').prop('disabled', !target.checked) 9 }) 6 10 7 11 $('.woorule-subscribe form').submit(function (e) { … … 11 15 let email = $('.woorule-subscribe #semail').val(); 12 16 let tags = $('.woorule-subscribe .tag').val(); 17 const requireOptIn = $('.woorule-subscribe [name="require-opt-in"]').val(); 13 18 14 19 if ((!email) || (email.length < 4)) { … … 28 33 nonce: ajax_var.nonce, 29 34 email, 30 tags 35 tags, 36 requireOptIn 31 37 }, 32 38 success(data) { -
woorule/trunk/inc/class-rulemailer-api.php
r2665748 r2680885 38 38 static::log( 'Error: ' . $resp->get_error_message() ); 39 39 } else { 40 static::log( 'Subscribe Success: ' . print_r( $resp['body'], true ) ); 41 static::log( 'Subscribe Success: ' . print_r( $body_data, true ) ); 40 $resp = json_decode( wp_remote_retrieve_body( $resp ), true ); 41 if ( isset( $resp['error'] ) ) { 42 static::log( 'Error: ' . wc_print_r( $resp, true ) ); 43 static::log( 'Error: ' . wc_print_r( $body_data, true ) ); 44 } else { 45 static::log( 'Subscribe Success: ' . wc_print_r( $resp, true ) ); 46 static::log( 'Subscribe Success: ' . wc_print_r( $body_data, true ) ); 47 } 42 48 } 43 49 } … … 63 69 static::log( 'Error delete subscriber tag: ' . $resp->get_error_message() ); 64 70 } else { 65 static::log( 'Subscriber tag deleted successfully: ' . print_r( $resp['body'], true ) ); 71 $resp = json_decode( wp_remote_retrieve_body( $resp ), true ); 72 if ( isset( $resp['error'] ) ) { 73 static::log( 'Error: ' . wc_print_r( $resp, true ) ); 74 static::log( 'Error: ' . wc_print_r( compact( 'email', 'tag' ), true ) ); 75 } else { 76 static::log( 'Subscriber tag deleted successfully: ' . wc_print_r( $resp, true ) ); 77 } 66 78 } 67 79 } … … 79 91 80 92 if ( is_array( $msg ) || is_object( $msg ) ) { 81 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r 82 $logger->add( 'woorule', print_r( $msg, true ) ); 93 $logger->add( 'woorule', wc_print_r( $msg, true ) ); 83 94 } else { 84 95 $logger->add( 'woorule', $msg ); -
woorule/trunk/inc/class-woorule-cart-hooks.php
r2671567 r2680885 83 83 if ( ! $this->retrieve_current_customer() ) { 84 84 return; 85 } 86 87 $email = $this->current_customer->get_billing_email(); 88 if ( empty( $email ) ) { 89 $email = $this->current_customer->get_email(); 85 90 } 86 91 … … 98 103 'tags' => $this->get_subscription_tags(), 99 104 'subscribers' => array( 100 'email' => $ this->current_customer->get_billing_email(),105 'email' => $email, 101 106 'phone_number' => $this->current_customer->get_billing_phone(), 102 107 'language' => substr( get_locale(), 0, 2 ), -
woorule/trunk/inc/class-woorule-order-hooks.php
r2671567 r2680885 71 71 RuleMailer_API::subscribe( $subscription ); 72 72 73 if ( $order->meta_exists( '_cart_in_progress_deleted' ) ) {73 if ( ! $order->meta_exists( '_cart_in_progress_deleted' ) ) { 74 74 RuleMailer_API::delete_subscriber_tag( $order->get_billing_email(), 'CartInProgress' ); 75 $order->add_meta_data( '_cart_in_progress_deleted', true );75 $order->add_meta_data( '_cart_in_progress_deleted', true, true ); 76 76 $order->save(); 77 77 } -
woorule/trunk/inc/class-woorule-shortcode.php
r2671567 r2680885 78 78 'error' => __( 'Oops, something is wrong..', 'woorule' ), 79 79 'tag' => '', 80 'checkbox' => '', 81 'require_opt_in' => false, 80 82 ), 81 83 $atts, … … 122 124 } 123 125 126 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash 127 $require_opt_in = filter_var( $_POST['requireOptIn'], FILTER_VALIDATE_BOOLEAN ); 128 124 129 $subscription = array( 125 130 'apikey' => Woorule_Options::get_api_key(), … … 132 137 'email' => $email, 133 138 ), 139 'require_opt_in' => $require_opt_in, 134 140 ); 135 141 -
woorule/trunk/inc/partials/shortcode-woorule.php
r2661379 r2680885 15 15 <label for="semail" class="form_elem"><?php echo esc_html( $args['title'] ); ?></label> 16 16 <input type="text" id="semail" name="email" class="form_elem" placeholder="<?php echo esc_html( $args['placeholder'] ); ?>"/> 17 <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem"/> 17 <input type="submit" value="<?php echo esc_html( $args['submit'] ); ?>" class="form_elem" 18 <?php disabled( ! empty( $args['checkbox'] ) ); ?> 19 /> 18 20 <input type="hidden" value="<?php echo esc_html( $args['tag'] ); ?>" name="tags" class="tag"/> 21 <input type="hidden" value="<?php echo esc_html( $args['require_opt_in'] ); ?>" name="require-opt-in"/> 19 22 <p class="hidden success"><?php echo esc_html( $args['success'] ); ?></p> 20 23 <p class="hidden error"><?php echo esc_html( $args['error'] ); ?></p> 24 25 <?php if ( $args['checkbox'] ) : ?> 26 <label> 27 <input type="checkbox" class="woorule-subscribe__checkbox"> 28 <?php echo wp_kses_post( $args['checkbox'] ); ?> 29 </label> 30 <?php endif; ?> 21 31 </form> 22 32 </div> -
woorule/trunk/languages/woorule.pot
r2671567 r2680885 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WooRule 2. 6.0\n"5 "Project-Id-Version: WooRule 2.7.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woorule\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 12 12 "POT-Creation-Date: 2022-02-02T11:13:33+03:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 6.0\n"14 "X-Generator: WP-CLI 2.7.0\n" 15 15 "X-Domain: woorule\n" 16 16 -
woorule/trunk/woorule.php
r2671567 r2680885 9 9 * Plugin URI: http://github.com/rulecom/woorule 10 10 * Description: Rule integration for WooCommerce 11 * Version: 2. 6.011 * Version: 2.7.0 12 12 * Author: Rule 13 13 * Author URI: http://rule.se … … 19 19 */ 20 20 21 define( 'WOORULE_VERSION', '2. 6.0' );21 define( 'WOORULE_VERSION', '2.7.0' ); 22 22 define( 'WOORULE_PATH', plugin_dir_path( __FILE__ ) ); 23 23 define( 'WOORULE_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.