Changeset 3275461
- Timestamp:
- 04/17/2025 07:18:47 AM (12 months ago)
- Location:
- pitchprint
- Files:
-
- 10 edited
- 1 copied
-
tags/11.0.5 (copied) (copied from pitchprint/trunk)
-
tags/11.0.5/functions/admin/orders.php (modified) (1 diff)
-
tags/11.0.5/functions/general/customization.php (modified) (3 diffs)
-
tags/11.0.5/functions/general/init_hooks.php (modified) (1 diff)
-
tags/11.0.5/pitchprint.php (modified) (2 diffs)
-
tags/11.0.5/readme.txt (modified) (3 diffs)
-
trunk/functions/admin/orders.php (modified) (1 diff)
-
trunk/functions/general/customization.php (modified) (3 diffs)
-
trunk/functions/general/init_hooks.php (modified) (1 diff)
-
trunk/pitchprint.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pitchprint/tags/11.0.5/functions/admin/orders.php
r3274379 r3275461 96 96 return $formatted_meta; 97 97 } 98 99 function handle_new_order( $order_id, $order ) { 100 $items = $order->get_items(); 101 $should_update_user_id = false; 102 $project_ids = []; 103 $user_id = $order->get_user_id(); 104 105 foreach ( $items as $item ) { 106 foreach ( $item->get_meta_data() as $meta ) { 107 if ( $meta->key === PITCHPRINT_CUSTOMIZATION_KEY ) { 108 $pitchprint_customization = $meta->value; 109 110 if ( is_string($pitchprint_customization) ) { 111 $pitchprint_customization = json_decode( $pitchprint_customization, true ); 112 } 113 114 if ( !empty($pitchprint_customization['projectId']) ) { 115 if ( $user_id && $pitchprint_customization['userId'] === 'guest' ) { 116 $should_update_user_id = true; 117 } 118 $project_ids[] = $pitchprint_customization['projectId']; 119 } 120 } 121 } 122 } 123 124 if ( count($project_ids) ) { 125 $auth_key = get_option( 'ppa_secret_key' ); 126 // Append order ID 127 $response1 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-order-id', [ 128 'headers' => [ 'Authorization' => $auth_key ], 129 'body' => json_encode( [ 130 'projectIds' => $project_ids, 131 'orderId' => $order_id, 132 ] ), 133 'method' => 'POST', 134 ] ); 135 136 if ( is_wp_error( $response1 ) || wp_remote_retrieve_response_code( $response1 ) !== 200 ) { 137 error_log( '[PitchPrint] Failed to append order ID to projects: ' . print_r( $response1, true ) ); 138 } 139 140 // Append user ID if needed 141 if ( $should_update_user_id ) { 142 $response2 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-user-id', [ 143 'headers' => [ 'Authorization' => $auth_key ], 144 'body' => json_encode( [ 145 'projectIds' => $project_ids, 146 'userId' => $user_id, 147 ] ), 148 'method' => 'POST', 149 ] ); 150 151 if ( is_wp_error( $response2 ) || wp_remote_retrieve_response_code( $response2 ) !== 200 ) { 152 error_log( '[PitchPrint] Failed to append user ID to projects: ' . print_r( $response2, true ) ); 153 } 154 } 155 } 156 } 157 98 158 99 159 function order_status_completed($order_id, $status_from, $status_to) { -
pitchprint/tags/11.0.5/functions/general/customization.php
r3270976 r3275461 6 6 if (!isset($_COOKIE[PITCHPRINT_CUSTOMIZATION_KEY])) { 7 7 $token = bin2hex(random_bytes(16)); 8 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 8 if (!headers_sent()) { 9 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 10 } 9 11 } 10 12 } … … 16 18 // Generate a random token for the user (guest or signed-in) 17 19 $token = bin2hex(random_bytes(16)); 18 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 20 if (!headers_sent()) { 21 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 22 } 19 23 return $token; 20 24 } … … 43 47 return TRUE; 44 48 } 45 -
pitchprint/tags/11.0.5/functions/general/init_hooks.php
r3274379 r3275461 64 64 65 65 add_action('woocommerce_order_status_changed', 'pitchprint\\functions\\admin\\order_status_completed',10,3); 66 add_action('woocommerce_new_order', 'pitchprint\\functions\\admin\\handle_new_order',10,2); 66 67 67 68 // add the customization info to the order email -
pitchprint/tags/11.0.5/pitchprint.php
r3274379 r3275461 6 6 * Description: A beautiful web based print customization app for your online store. Integrates with WooCommerce. 7 7 * Author: PitchPrint, Inc. 8 * Version: 11.0. 48 * Version: 11.0.5 9 9 * Author URI: https://pitchprint.com 10 10 * Requires at least: 3.8 … … 47 47 * @var string 48 48 */ 49 public $version = '11.0. 4';49 public $version = '11.0.5'; 50 50 51 51 /** -
pitchprint/tags/11.0.5/readme.txt
r3274379 r3275461 4 4 Requires at least: 3.8 5 5 Tested up to: 6.7 6 Stable tag: 11.0. 46 Stable tag: 11.0.5 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 64 64 **Data Form Module** - Displays a Quick-edit Form where your customers can simply type in their details and be done with. It is suitable for quick edits without having to manipulate directly on the canvas. 65 65 66 !(Data Form)[https://pitchprint.com/assets/img/use/data-form-new.png]67 68 66 **Template Colour Module** - Change the template image colour of a design product without going outside of the editor. 69 67 70 !(Template Color Module)[https://pitchprint.com/assets/img/use/template-color-module.png]71 72 68 **Page Loader** - Load additional pages into designs from an assigned source design. Perfect for Magazines, Menu, Programmes, Business Cards, Swatch Cards, Direct Mail Marketing, Brochures etc. 73 69 74 !(Page Loader Module)[https://pitchprint.com/assets/img/use/page-loader.png]75 76 70 **Display Modes** - Configure how the application appears in your product page with our 3 different display mode options to suit any of your product needs. 77 71 78 72 **Layouts** - Enabling users to create different layout and assign them to different sets of designs based on your unique website need basis. 79 73 80 !(Layouts)[https://pitchprint.com/assets/img/use/layout.png]81 82 74 **Canvas Adjuster** - Large prints come in different shapes and sizes, with this module you can adjust the canvas dimensions before or during designing. You can opt for custom dimensions or pick from a list of pre-set values. 83 75 84 !(Canvas Adjuster)[https://pitchprint.com/assets/img/use/canvas-adjuster-new.png]85 86 76 **Smart Sizes** - Create multiple variations of a single design by varying the canvas size and elements’ properties to come up with entirely different looking layouts. i.e. Landscape, Portrait, Square in seconds saving you time to focus on what matters, the customers! 87 77 88 !(Smart Sizes)[https://pitchprint.com/assets/img/use/smart-resize.png]89 90 78 **High Res** - You get high resolution print-ready PDF with crisp, clean vector elements in either CMYK with SPOT colors or RGB format. In addition, you can download files as JPEG or PNG. 91 79 92 !(High Res)[https://pitchprint.com/assets/img/use/transp-high-res.png]93 94 80 **Variable Data** - An API that allows you to programmatically create multiple print-ready PDF files without launching the design editor. Perfect for business cards, direct mail marketing etc. 95 81 96 !(Variable Data)[https://pitchprint.com/assets/img/use/spark-new.png]97 98 82 **Styling** - From the language to the themes and layout, you can customize the app to blend right into your store’s look and feel. Include your own CSS or Custom JavaScript code to add functionalities. More so, you can edit the HTML to remove features you don’t need. 99 83 100 !(Styling)[https://pitchprint.com/assets/img/use/styling.png]101 102 84 **Google Fonts** - Search and use Google Fonts directly in the design editor. Add Google fonts or upload your own TTF or OTF, the choice is all yours!!! 103 85 104 !(Fonts)[https://pitchprint.com/assets/img/use/fonts.gif]105 106 86 **Pixabay** - We have also integrated Pixabay which is a collection of royalty free photos and illustrations. And so much more!!! 107 108 !(Pixabay)[https://pitchprint.com/assets/img/use/pixabay-lrg.gif]109 87 110 88 … … 193 171 194 172 == Changelog == 173 174 == 11.0.5 = 175 Plugin reports and updates orderId against a PitchPrint project 176 Updates the userId, if a user was a guest when an order was placed 195 177 196 178 == 11.0.4 = -
pitchprint/trunk/functions/admin/orders.php
r3274379 r3275461 96 96 return $formatted_meta; 97 97 } 98 99 function handle_new_order( $order_id, $order ) { 100 $items = $order->get_items(); 101 $should_update_user_id = false; 102 $project_ids = []; 103 $user_id = $order->get_user_id(); 104 105 foreach ( $items as $item ) { 106 foreach ( $item->get_meta_data() as $meta ) { 107 if ( $meta->key === PITCHPRINT_CUSTOMIZATION_KEY ) { 108 $pitchprint_customization = $meta->value; 109 110 if ( is_string($pitchprint_customization) ) { 111 $pitchprint_customization = json_decode( $pitchprint_customization, true ); 112 } 113 114 if ( !empty($pitchprint_customization['projectId']) ) { 115 if ( $user_id && $pitchprint_customization['userId'] === 'guest' ) { 116 $should_update_user_id = true; 117 } 118 $project_ids[] = $pitchprint_customization['projectId']; 119 } 120 } 121 } 122 } 123 124 if ( count($project_ids) ) { 125 $auth_key = get_option( 'ppa_secret_key' ); 126 // Append order ID 127 $response1 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-order-id', [ 128 'headers' => [ 'Authorization' => $auth_key ], 129 'body' => json_encode( [ 130 'projectIds' => $project_ids, 131 'orderId' => $order_id, 132 ] ), 133 'method' => 'POST', 134 ] ); 135 136 if ( is_wp_error( $response1 ) || wp_remote_retrieve_response_code( $response1 ) !== 200 ) { 137 error_log( '[PitchPrint] Failed to append order ID to projects: ' . print_r( $response1, true ) ); 138 } 139 140 // Append user ID if needed 141 if ( $should_update_user_id ) { 142 $response2 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-user-id', [ 143 'headers' => [ 'Authorization' => $auth_key ], 144 'body' => json_encode( [ 145 'projectIds' => $project_ids, 146 'userId' => $user_id, 147 ] ), 148 'method' => 'POST', 149 ] ); 150 151 if ( is_wp_error( $response2 ) || wp_remote_retrieve_response_code( $response2 ) !== 200 ) { 152 error_log( '[PitchPrint] Failed to append user ID to projects: ' . print_r( $response2, true ) ); 153 } 154 } 155 } 156 } 157 98 158 99 159 function order_status_completed($order_id, $status_from, $status_to) { -
pitchprint/trunk/functions/general/customization.php
r3270976 r3275461 6 6 if (!isset($_COOKIE[PITCHPRINT_CUSTOMIZATION_KEY])) { 7 7 $token = bin2hex(random_bytes(16)); 8 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 8 if (!headers_sent()) { 9 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 10 } 9 11 } 10 12 } … … 16 18 // Generate a random token for the user (guest or signed-in) 17 19 $token = bin2hex(random_bytes(16)); 18 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 20 if (!headers_sent()) { 21 setcookie(PITCHPRINT_CUSTOMIZATION_KEY, $token, time() + PITCHPRINT_CUSTOMIZATION_DURATION, '/'); 22 } 19 23 return $token; 20 24 } … … 43 47 return TRUE; 44 48 } 45 -
pitchprint/trunk/functions/general/init_hooks.php
r3274379 r3275461 64 64 65 65 add_action('woocommerce_order_status_changed', 'pitchprint\\functions\\admin\\order_status_completed',10,3); 66 add_action('woocommerce_new_order', 'pitchprint\\functions\\admin\\handle_new_order',10,2); 66 67 67 68 // add the customization info to the order email -
pitchprint/trunk/pitchprint.php
r3274379 r3275461 6 6 * Description: A beautiful web based print customization app for your online store. Integrates with WooCommerce. 7 7 * Author: PitchPrint, Inc. 8 * Version: 11.0. 48 * Version: 11.0.5 9 9 * Author URI: https://pitchprint.com 10 10 * Requires at least: 3.8 … … 47 47 * @var string 48 48 */ 49 public $version = '11.0. 4';49 public $version = '11.0.5'; 50 50 51 51 /** -
pitchprint/trunk/readme.txt
r3274379 r3275461 4 4 Requires at least: 3.8 5 5 Tested up to: 6.7 6 Stable tag: 11.0. 46 Stable tag: 11.0.5 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 64 64 **Data Form Module** - Displays a Quick-edit Form where your customers can simply type in their details and be done with. It is suitable for quick edits without having to manipulate directly on the canvas. 65 65 66 !(Data Form)[https://pitchprint.com/assets/img/use/data-form-new.png]67 68 66 **Template Colour Module** - Change the template image colour of a design product without going outside of the editor. 69 67 70 !(Template Color Module)[https://pitchprint.com/assets/img/use/template-color-module.png]71 72 68 **Page Loader** - Load additional pages into designs from an assigned source design. Perfect for Magazines, Menu, Programmes, Business Cards, Swatch Cards, Direct Mail Marketing, Brochures etc. 73 69 74 !(Page Loader Module)[https://pitchprint.com/assets/img/use/page-loader.png]75 76 70 **Display Modes** - Configure how the application appears in your product page with our 3 different display mode options to suit any of your product needs. 77 71 78 72 **Layouts** - Enabling users to create different layout and assign them to different sets of designs based on your unique website need basis. 79 73 80 !(Layouts)[https://pitchprint.com/assets/img/use/layout.png]81 82 74 **Canvas Adjuster** - Large prints come in different shapes and sizes, with this module you can adjust the canvas dimensions before or during designing. You can opt for custom dimensions or pick from a list of pre-set values. 83 75 84 !(Canvas Adjuster)[https://pitchprint.com/assets/img/use/canvas-adjuster-new.png]85 86 76 **Smart Sizes** - Create multiple variations of a single design by varying the canvas size and elements’ properties to come up with entirely different looking layouts. i.e. Landscape, Portrait, Square in seconds saving you time to focus on what matters, the customers! 87 77 88 !(Smart Sizes)[https://pitchprint.com/assets/img/use/smart-resize.png]89 90 78 **High Res** - You get high resolution print-ready PDF with crisp, clean vector elements in either CMYK with SPOT colors or RGB format. In addition, you can download files as JPEG or PNG. 91 79 92 !(High Res)[https://pitchprint.com/assets/img/use/transp-high-res.png]93 94 80 **Variable Data** - An API that allows you to programmatically create multiple print-ready PDF files without launching the design editor. Perfect for business cards, direct mail marketing etc. 95 81 96 !(Variable Data)[https://pitchprint.com/assets/img/use/spark-new.png]97 98 82 **Styling** - From the language to the themes and layout, you can customize the app to blend right into your store’s look and feel. Include your own CSS or Custom JavaScript code to add functionalities. More so, you can edit the HTML to remove features you don’t need. 99 83 100 !(Styling)[https://pitchprint.com/assets/img/use/styling.png]101 102 84 **Google Fonts** - Search and use Google Fonts directly in the design editor. Add Google fonts or upload your own TTF or OTF, the choice is all yours!!! 103 85 104 !(Fonts)[https://pitchprint.com/assets/img/use/fonts.gif]105 106 86 **Pixabay** - We have also integrated Pixabay which is a collection of royalty free photos and illustrations. And so much more!!! 107 108 !(Pixabay)[https://pitchprint.com/assets/img/use/pixabay-lrg.gif]109 87 110 88 … … 193 171 194 172 == Changelog == 173 174 == 11.0.5 = 175 Plugin reports and updates orderId against a PitchPrint project 176 Updates the userId, if a user was a guest when an order was placed 195 177 196 178 == 11.0.4 =
Note: See TracChangeset
for help on using the changeset viewer.