Skip to content

Commit 9a804e4

Browse files
committed
= 2.1.1 =
Initialized the cookie before any header is set on the app
1 parent f6c59f4 commit 9a804e4

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Print.App
22

3-
## Version 2.1.0 plugin
3+
## Version 2.1.1 plugin
44
PrintApp is a platform that allows your customers to personalize their Print orders on any web store.
55
It provides customers, an easy to use WYSIWYG (What you see is what you get) "Do It Yourself" interface for creating artworks for Print.
66

functions/general/customization.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
namespace printapp\functions\general;
44

5+
function set_cookie() {
6+
if (!isset($_COOKIE[PRINT_APP_CUSTOMIZATION_KEY])) {
7+
$token = bin2hex(random_bytes(16));
8+
setcookie(PRINT_APP_CUSTOMIZATION_KEY, $token, time() + PRINT_APP_CUSTOMIZATION_DURATION, '/');
9+
}
10+
}
11+
512
function get_user_token() {
613
if (isset($_COOKIE[PRINT_APP_CUSTOMIZATION_KEY]))
714
return $_COOKIE[PRINT_APP_CUSTOMIZATION_KEY];

functions/general/init_hooks.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ function init_hooks() {
4444
add_filter('woocommerce_checkout_create_order_line_item', 'printapp\\functions\\front\\add_order_item_meta', 70, 2);
4545

4646
}
47+
48+
add_action('init', 'printapp\\functions\\general\\set_cookie');
4749

4850
// save project for both authenticated and guest users
4951
add_action('wp_ajax_nopriv_print_app_save_project', 'printapp\\functions\\front\\save_project_sess');

printapp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Print.App
44
* Plugin URI: https://print.app
55
* Description: Empower your customers to personalize products like Business Cards, Photo Prints, T-Shirts, Mugs, Banners, Canvases, etc. on your store before purchase
6-
* Version: 2.1.0
6+
* Version: 2.1.1
77
* Requires at least: 3.8
88
* Requires PHP: 5.2.4
99
* Author: 36 Studios, Inc.
@@ -45,7 +45,7 @@ class PrintApp {
4545
* PrintApp version.
4646
* @var string
4747
*/
48-
public $version = '2.1.0';
48+
public $version = '2.1.1';
4949

5050
/**
5151
* The single instance of the class.

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: Print.App
33
Tags: customizer, photo album, print shop, web2print, gift print, diy print, product customizer, web-to-print, print software, print solution, HTML5 WYSIWYG, t-shirt designer, wysiwyg print editor, business card
44
Requires at least: 3.8
55
Tested up to: 6.6
6-
Stable tag: 2.1.0
6+
Stable tag: 2.1.1
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -101,6 +101,9 @@ Check out our [website for more details](https://print.app)
101101

102102
== Changelog ==
103103

104+
= 2.1.1 =
105+
Initialized the cookie before any header is set on the app
106+
104107
= 2.1.0 =
105108
Switched from using Sessions to using Wordpress Transients for saving customization details.
106109
Sessions are prone to conflicts with other plugins and systems.

0 commit comments

Comments
 (0)