Skip to content

Commit 0942814

Browse files
committed
Merge branch 'release/2.0.12'
2 parents 7fd2ded + 544a9fd commit 0942814

File tree

11 files changed

+125
-53
lines changed

11 files changed

+125
-53
lines changed

assets/js/admin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
loader.show();
9999
var remote_message = $( '#wcct_remote_notice' );
100100
wp.ajax.send( 'activate_happy_addons', {
101+
data: {
102+
_wpnonce: wc_tracking.nonce,
103+
},
101104
success: function( response ) {
102105
$('.wcct-notice-wrap').hide();
103106
loader.hide();
@@ -114,6 +117,9 @@
114117
// Dismiss notice
115118
$('.wcct-notice-wrap').on( 'click', function() {
116119
wp.ajax.send( 'wcct_dismissable_notice', {
120+
data: {
121+
_wpnonce: wc_tracking.nonce,
122+
},
117123
success: function( response ) {
118124
console.log( 'Success' );
119125
}

assets/js/admin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"require": {
1414
"php": ">=7.0",
1515
"composer/installers": "^1.9",
16-
"appsero/client": "dev-develop"
16+
"appsero/client": "^2.0"
1717
},
1818

1919
"require-dev": {

composer.lock

Lines changed: 48 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conversion-tracking.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Plugin Name: WooCommerce Conversion Tracking
44
Plugin URI: https://wedevs.com/woocommerce-conversion-tracking/
55
Description: Adds various conversion tracking codes to cart, checkout, registration success and product page on WooCommerce
6-
Version: 2.0.11
6+
Version: 2.0.12
77
Author: weDevs
88
Author URI: https://wedevs.com/?utm_source=ORG_Author_URI_WCCT
99
License: GPL2
1010
WC requires at least: 5.0.0
11-
WC tested up to: 8.1.0
11+
WC tested up to: 8.5.1
1212
*/
1313

1414
/**
@@ -54,7 +54,7 @@ class WeDevs_WC_Conversion_Tracking {
5454
*
5555
* @var string
5656
*/
57-
public $version = '2.0.11';
57+
public $version = '2.0.12';
5858

5959
/**
6060
* Holds various class instances
@@ -266,6 +266,7 @@ public function init_tracker() {
266266
public function add_hpos_support() {
267267
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
268268
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
269+
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
269270
}
270271
}
271272

includes/class-admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function enqueue_scripts() {
3333
wp_localize_script(
3434
'wcct-admin', 'wc_tracking', array(
3535
'ajaxurl' => admin_url( 'admin-ajax.php' ),
36+
'nonce' => wp_create_nonce( 'wcct-settings' ),
3637
)
3738
);
3839
}

includes/class-ajax.php

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@ public function __construct() {
2121
* @return void
2222
*/
2323
public function wcct_save_settings() {
24-
if ( ! current_user_can( wcct_manage_cap() ) ) {
24+
if ( ! current_user_can( 'manage_options' ) ) {
2525
return;
2626
}
27-
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '';
2827

29-
if ( ! wp_verify_nonce( $nonce, 'wcct-settings' ) ) {
30-
die( 'wcct-settings !' );
28+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wcct-settings' ) ) {
29+
wp_send_json_error(
30+
[
31+
'message' => __( 'nonce verification failed', 'woocommerce-conversion-tracking' )
32+
]
33+
);
3134
}
3235

3336
if ( ! isset( $_POST['settings'] ) ) {
3437
wp_send_json_error();
3538
}
3639

3740
$integration_settings = array();
38-
// $post_data = isset( $_POST['settings'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['settings'] ) ) : [];
3941

4042
if ( ! empty( $_POST['settings'] ) ) {
4143

@@ -61,6 +63,21 @@ public function wcct_save_settings() {
6163
* @return json
6264
*/
6365
public function wcct_install_happy_addons() {
66+
if ( ! current_user_can( 'manage_options' ) ) {
67+
wp_send_json_error(
68+
[
69+
'message' => __( 'You do not have permission to install Happy Addons', 'woocommerce-conversion-tracking' )
70+
]
71+
);
72+
}
73+
74+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wcct-settings' ) ) {
75+
wp_send_json_error(
76+
[
77+
'message' => __( 'nonce verification failed', 'woocommerce-conversion-tracking' )
78+
]
79+
);
80+
}
6481

6582
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
6683
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
@@ -108,7 +125,19 @@ public function wcct_install_happy_addons() {
108125
*/
109126
public function wcct_dismissable_notice() {
110127
if ( ! current_user_can( 'manage_options' ) ) {
111-
return;
128+
wp_send_json_error(
129+
[
130+
'message' => __( 'You do not have permission to install Happy Addons', 'woocommerce-conversion-tracking' )
131+
]
132+
);
133+
}
134+
135+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wcct-settings' ) ) {
136+
wp_send_json_error(
137+
[
138+
'message' => __( 'nonce verification failed', 'woocommerce-conversion-tracking' )
139+
]
140+
);
112141
}
113142

114143
update_option( 'wcct_dismissable_notice', 'closed' );

languages/woocommerce-conversion-tracking.pot

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Copyright (C) 2023 weDevs
1+
# Copyright (C) 2024 weDevs
22
# This file is distributed under the GPL2.
33
msgid ""
44
msgstr ""
55
"Project-Id-Version: WooCommerce Conversion Tracking 2.0.11\n"
66
"Report-Msgid-Bugs-To: https://example.com\n"
7-
"POT-Creation-Date: 2023-09-15 11:33:43+00:00\n"
7+
"POT-Creation-Date: 2024-01-16 10:36:36+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
11-
"PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n"
11+
"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
1414
"X-Generator: grunt-wp-i18n 0.5.4\n"
@@ -37,23 +37,32 @@ msgid ""
3737
"Addons for Elementor to shape your dream.</strong> 😊"
3838
msgstr ""
3939

40-
#: includes/class-admin.php:49
40+
#: includes/class-admin.php:50
4141
msgid "Conversion Tracking"
4242
msgstr ""
4343

44-
#: includes/class-admin.php:73
44+
#: includes/class-admin.php:74
4545
msgid "Integrations"
4646
msgstr ""
4747

48-
#: includes/class-ajax.php:54
48+
#: includes/class-ajax.php:31 includes/class-ajax.php:77
49+
#: includes/class-ajax.php:138
50+
msgid "nonce verification failed"
51+
msgstr ""
52+
53+
#: includes/class-ajax.php:56
4954
msgid "Settings has been saved successfully!"
5055
msgstr ""
5156

52-
#: includes/class-ajax.php:75
57+
#: includes/class-ajax.php:69 includes/class-ajax.php:130
58+
msgid "You do not have permission to install Happy Addons"
59+
msgstr ""
60+
61+
#: includes/class-ajax.php:92
5362
msgid "ERROR: Error fetching plugin information: %s"
5463
msgstr ""
5564

56-
#: includes/class-ajax.php:100
65+
#: includes/class-ajax.php:117
5766
msgid "Successfully installed and activate,"
5867
msgstr ""
5968

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Woocommerce-Conversion-Tracking",
3-
"version": "2.0.11",
3+
"version": "2.0.12",
44
"description": "Conversion tracking plugin for WooCommerce",
55
"author": "Tareq Hasan",
66
"license": "GPL",

0 commit comments

Comments
 (0)