Changeset 3205331
- Timestamp:
- 12/10/2024 07:58:59 AM (16 months ago)
- Location:
- printapp
- Files:
-
- 2 added
- 14 edited
- 1 copied
-
tags/2.1.0 (copied) (copied from printapp/trunk)
-
tags/2.1.0/CHANGELOG.txt (modified) (1 diff)
-
tags/2.1.0/README.md (modified) (1 diff)
-
tags/2.1.0/functions/front/carts.php (modified) (1 diff)
-
tags/2.1.0/functions/front/customize_button.php (modified) (4 diffs)
-
tags/2.1.0/functions/front/projects.php (modified) (3 diffs)
-
tags/2.1.0/functions/general/customization.php (added)
-
tags/2.1.0/printapp.php (modified) (3 diffs)
-
tags/2.1.0/readme.txt (modified) (2 diffs)
-
trunk/CHANGELOG.txt (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/functions/front/carts.php (modified) (1 diff)
-
trunk/functions/front/customize_button.php (modified) (4 diffs)
-
trunk/functions/front/projects.php (modified) (3 diffs)
-
trunk/functions/general/customization.php (added)
-
trunk/printapp.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
printapp/tags/2.1.0/CHANGELOG.txt
r3195438 r3205331 1 = 2.1.0 = 2 Switched from using Sessions to using Wordpress Transients for saving customization details. 3 Sessions are prone to conflicts with other plugins and systems. 4 1 5 == 2.0.3 = 2 6 Minor update to release.yml to copy functions folder -
printapp/tags/2.1.0/README.md
r3195438 r3205331 1 1 # Print.App 2 2 3 ## Version 2. 0.3plugin3 ## Version 2.1.0 plugin 4 4 PrintApp is a platform that allows your customers to personalize their Print orders on any web store. 5 5 It provides customers, an easy to use WYSIWYG (What you see is what you get) "Do It Yourself" interface for creating artworks for Print. -
printapp/tags/2.1.0/functions/front/carts.php
r3195438 r3205331 3 3 namespace printapp\functions\front; 4 4 5 use printapp\functions\general as General; 6 5 7 function add_cart_item_data($cart_item_data, $product_id, $variation_id, $qty) { 6 if (!session_id()) session_start();7 8 8 $ session_key = PRINT_APP_SESSION_PREFIX . $product_id;9 $value = General\get_customization_data($product_id); 9 10 10 if (isset($ _SESSION[$session_key])) {11 $cart_item_data[PRINT_APP_CUSTOMIZATION_KEY] = $ _SESSION[$session_key];12 unset($_SESSION[$session_key]);11 if (isset($value) && $value !== FALSE) { 12 $cart_item_data[PRINT_APP_CUSTOMIZATION_KEY] = $value; 13 General\delete_customization_data($product_id); 13 14 } 14 15 -
printapp/tags/2.1.0/functions/front/customize_button.php
r3195438 r3205331 2 2 3 3 namespace printapp\functions\front; 4 5 use printapp\functions\general as General; 4 6 5 7 function customize_button() { … … 16 18 $user_data = get_user_data(); 17 19 18 if (!session_id()) session_start();19 20 20 // get project data 21 if (session_id()) { 22 $session_key = PRINT_APP_SESSION_PREFIX . $post->ID; 23 if (isset($_SESSION[$session_key])) $project_data = $_SESSION[$session_key]; 24 } 21 $project_data = General\get_customization_data($post->ID); 25 22 26 23 // initialize the data to pass to print_app_class … … 30 27 $pa_user_id = (get_current_user_id() === 0) ? 'guest' : get_current_user_id(); 31 28 32 if (isset($project_data) ) {29 if (isset($project_data) && $project_data !== FALSE) { 33 30 $pa_project_id = $project_data['projectId']; 34 31 $pa_mode = isset($project_data['mode']) ? $project_data['mode'] : 'edit-project'; … … 55 52 56 53 function get_user_data() { 57 if (!is_user_logged_in()) return ' null';54 if (!is_user_logged_in()) return ''; 58 55 59 56 $customer = WC()->customer; -
printapp/tags/2.1.0/functions/front/projects.php
r3195438 r3205331 2 2 3 3 namespace printapp\functions\front; 4 5 use printapp\functions\general as General; 4 6 5 7 function save_project_sess() { … … 12 14 wp_send_json_error('No product ID provided'); 13 15 } 14 15 if (!session_id()) {16 session_start();17 if (!session_id()) wp_send_json_error('Failed to start session.');18 }19 16 20 17 $value = json_decode(stripslashes(html_entity_decode($_POST['value'])), true); 21 18 if (json_last_error() !== JSON_ERROR_NONE) wp_send_json_error(json_last_error()); 22 19 23 $product_id = intval($_POST['product_id']); 24 $session_key = PRINT_APP_SESSION_PREFIX . $product_id; 20 $product_id = $_POST['product_id']; 21 $result = General\save_customization_data($product_id, $value); 22 if ($result !== FALSE) 23 return wp_send_json_success('customization data saved successfully: ' . $result); 25 24 26 $_SESSION[$session_key] = $value; 27 wp_send_json_success('Customization data saved successfully'); 28 25 wp_send_json_error('Failed to save customization data'); 29 26 } 30 27 … … 34 31 } 35 32 36 if (!session_id()) { 37 session_start(); 38 if (!session_id()) wp_send_json_error('Failed to start session'); 39 } 33 $product_id = $_POST['product_id']; 40 34 41 // Sanitize product_id 42 $product_id = intval($_POST['product_id']); 43 $session_key = PRINT_APP_SESSION_PREFIX . $product_id; 44 45 // Check if session key exists and unset it 46 if (isset($_SESSION[$session_key])) { 47 unset($_SESSION[$session_key]); 48 wp_send_json_success('Customization data cleared successfully.'); 49 } else { 50 wp_send_json_error('No customization data found for this product'); 51 } 35 General\delete_customization_data($product_id); 36 wp_send_json_success('Customization data cleared successfully.'); 37 52 38 } -
printapp/tags/2.1.0/printapp.php
r3195438 r3205331 4 4 * Plugin URI: https://print.app 5 5 * 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. 0.36 * Version: 2.1.0 7 7 * Requires at least: 3.8 8 8 * Requires PHP: 5.2.4 … … 46 46 * @var string 47 47 */ 48 public $version = '2. 0.3';48 public $version = '2.1.0'; 49 49 50 50 /** … … 114 114 define('PRINT_APP_RUN_BASE_URL', 'https://run.print.app/'); 115 115 define('PRINT_APP_DESIGN_SELECT_JS', plugin_dir_url( __FILE__ ) . 'js/design-select.js'); 116 define('PRINT_APP_SESSION_PREFIX', 'print_app_sess_');117 116 define('PRINT_APP_CUSTOMIZATION_KEY', 'print_app_customization'); 118 117 define('PRINT_APP_CUSTOMIZATION_PREVIEWS_KEY', 'preview'); 118 define('PRINT_APP_CUSTOMIZATION_DURATION', MONTH_IN_SECONDS); 119 119 } 120 120 -
printapp/tags/2.1.0/readme.txt
r3195438 r3205331 4 4 Requires at least: 3.8 5 5 Tested up to: 6.6 6 Stable tag: 2. 0.36 Stable tag: 2.1.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 102 102 == Changelog == 103 103 104 = 2.1.0 = 105 Switched from using Sessions to using Wordpress Transients for saving customization details. 106 Sessions are prone to conflicts with other plugins and systems. 107 104 108 = 2.0.3 = 105 109 Minor update to release.yml to copy functions folder -
printapp/trunk/CHANGELOG.txt
r3195438 r3205331 1 = 2.1.0 = 2 Switched from using Sessions to using Wordpress Transients for saving customization details. 3 Sessions are prone to conflicts with other plugins and systems. 4 1 5 == 2.0.3 = 2 6 Minor update to release.yml to copy functions folder -
printapp/trunk/README.md
r3195438 r3205331 1 1 # Print.App 2 2 3 ## Version 2. 0.3plugin3 ## Version 2.1.0 plugin 4 4 PrintApp is a platform that allows your customers to personalize their Print orders on any web store. 5 5 It provides customers, an easy to use WYSIWYG (What you see is what you get) "Do It Yourself" interface for creating artworks for Print. -
printapp/trunk/functions/front/carts.php
r3195438 r3205331 3 3 namespace printapp\functions\front; 4 4 5 use printapp\functions\general as General; 6 5 7 function add_cart_item_data($cart_item_data, $product_id, $variation_id, $qty) { 6 if (!session_id()) session_start();7 8 8 $ session_key = PRINT_APP_SESSION_PREFIX . $product_id;9 $value = General\get_customization_data($product_id); 9 10 10 if (isset($ _SESSION[$session_key])) {11 $cart_item_data[PRINT_APP_CUSTOMIZATION_KEY] = $ _SESSION[$session_key];12 unset($_SESSION[$session_key]);11 if (isset($value) && $value !== FALSE) { 12 $cart_item_data[PRINT_APP_CUSTOMIZATION_KEY] = $value; 13 General\delete_customization_data($product_id); 13 14 } 14 15 -
printapp/trunk/functions/front/customize_button.php
r3195438 r3205331 2 2 3 3 namespace printapp\functions\front; 4 5 use printapp\functions\general as General; 4 6 5 7 function customize_button() { … … 16 18 $user_data = get_user_data(); 17 19 18 if (!session_id()) session_start();19 20 20 // get project data 21 if (session_id()) { 22 $session_key = PRINT_APP_SESSION_PREFIX . $post->ID; 23 if (isset($_SESSION[$session_key])) $project_data = $_SESSION[$session_key]; 24 } 21 $project_data = General\get_customization_data($post->ID); 25 22 26 23 // initialize the data to pass to print_app_class … … 30 27 $pa_user_id = (get_current_user_id() === 0) ? 'guest' : get_current_user_id(); 31 28 32 if (isset($project_data) ) {29 if (isset($project_data) && $project_data !== FALSE) { 33 30 $pa_project_id = $project_data['projectId']; 34 31 $pa_mode = isset($project_data['mode']) ? $project_data['mode'] : 'edit-project'; … … 55 52 56 53 function get_user_data() { 57 if (!is_user_logged_in()) return ' null';54 if (!is_user_logged_in()) return ''; 58 55 59 56 $customer = WC()->customer; -
printapp/trunk/functions/front/projects.php
r3195438 r3205331 2 2 3 3 namespace printapp\functions\front; 4 5 use printapp\functions\general as General; 4 6 5 7 function save_project_sess() { … … 12 14 wp_send_json_error('No product ID provided'); 13 15 } 14 15 if (!session_id()) {16 session_start();17 if (!session_id()) wp_send_json_error('Failed to start session.');18 }19 16 20 17 $value = json_decode(stripslashes(html_entity_decode($_POST['value'])), true); 21 18 if (json_last_error() !== JSON_ERROR_NONE) wp_send_json_error(json_last_error()); 22 19 23 $product_id = intval($_POST['product_id']); 24 $session_key = PRINT_APP_SESSION_PREFIX . $product_id; 20 $product_id = $_POST['product_id']; 21 $result = General\save_customization_data($product_id, $value); 22 if ($result !== FALSE) 23 return wp_send_json_success('customization data saved successfully: ' . $result); 25 24 26 $_SESSION[$session_key] = $value; 27 wp_send_json_success('Customization data saved successfully'); 28 25 wp_send_json_error('Failed to save customization data'); 29 26 } 30 27 … … 34 31 } 35 32 36 if (!session_id()) { 37 session_start(); 38 if (!session_id()) wp_send_json_error('Failed to start session'); 39 } 33 $product_id = $_POST['product_id']; 40 34 41 // Sanitize product_id 42 $product_id = intval($_POST['product_id']); 43 $session_key = PRINT_APP_SESSION_PREFIX . $product_id; 44 45 // Check if session key exists and unset it 46 if (isset($_SESSION[$session_key])) { 47 unset($_SESSION[$session_key]); 48 wp_send_json_success('Customization data cleared successfully.'); 49 } else { 50 wp_send_json_error('No customization data found for this product'); 51 } 35 General\delete_customization_data($product_id); 36 wp_send_json_success('Customization data cleared successfully.'); 37 52 38 } -
printapp/trunk/printapp.php
r3195438 r3205331 4 4 * Plugin URI: https://print.app 5 5 * 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. 0.36 * Version: 2.1.0 7 7 * Requires at least: 3.8 8 8 * Requires PHP: 5.2.4 … … 46 46 * @var string 47 47 */ 48 public $version = '2. 0.3';48 public $version = '2.1.0'; 49 49 50 50 /** … … 114 114 define('PRINT_APP_RUN_BASE_URL', 'https://run.print.app/'); 115 115 define('PRINT_APP_DESIGN_SELECT_JS', plugin_dir_url( __FILE__ ) . 'js/design-select.js'); 116 define('PRINT_APP_SESSION_PREFIX', 'print_app_sess_');117 116 define('PRINT_APP_CUSTOMIZATION_KEY', 'print_app_customization'); 118 117 define('PRINT_APP_CUSTOMIZATION_PREVIEWS_KEY', 'preview'); 118 define('PRINT_APP_CUSTOMIZATION_DURATION', MONTH_IN_SECONDS); 119 119 } 120 120 -
printapp/trunk/readme.txt
r3195438 r3205331 4 4 Requires at least: 3.8 5 5 Tested up to: 6.6 6 Stable tag: 2. 0.36 Stable tag: 2.1.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 102 102 == Changelog == 103 103 104 = 2.1.0 = 105 Switched from using Sessions to using Wordpress Transients for saving customization details. 106 Sessions are prone to conflicts with other plugins and systems. 107 104 108 = 2.0.3 = 105 109 Minor update to release.yml to copy functions folder
Note: See TracChangeset
for help on using the changeset viewer.