Changeset 3639204
- Timestamp:
- 08/09/2026 09:30:54 AM (2 months ago)
- Location:
- wizupapp
- Files:
-
- 2 added
- 6 edited
- 14 copied
-
tags/1.0.2 (copied) (copied from wizupapp/trunk )
-
tags/1.0.2/assets (copied) (copied from wizupapp/trunk/assets )
-
tags/1.0.2/assets/css/admin.css (copied) (copied from wizupapp/trunk/assets/css/admin.css )
-
tags/1.0.2/assets/js/admin.js (copied) (copied from wizupapp/trunk/assets/js/admin.js )
-
tags/1.0.2/includes (copied) (copied from wizupapp/trunk/includes )
-
tags/1.0.2/includes/class-wizup-admin.php (copied) (copied from wizupapp/trunk/includes/class-wizup-admin.php ) (2 diffs)
-
tags/1.0.2/includes/class-wizup-api.php (modified) (3 diffs)
-
tags/1.0.2/includes/class-wizup-crm-webhook.php (added)
-
tags/1.0.2/includes/class-wizup-front-end.php (copied) (copied from wizupapp/trunk/includes/class-wizup-front-end.php )
-
tags/1.0.2/includes/class-wizup-order-hooks.php (copied) (copied from wizupapp/trunk/includes/class-wizup-order-hooks.php )
-
tags/1.0.2/languages (copied) (copied from wizupapp/trunk/languages )
-
tags/1.0.2/readme.txt (copied) (copied from wizupapp/trunk/readme.txt ) (2 diffs)
-
tags/1.0.2/uninstall.php (copied) (copied from wizupapp/trunk/uninstall.php )
-
tags/1.0.2/views (copied) (copied from wizupapp/trunk/views )
-
tags/1.0.2/views/admin-settings.php (copied) (copied from wizupapp/trunk/views/admin-settings.php ) (1 diff)
-
tags/1.0.2/wizupapp.php (copied) (copied from wizupapp/trunk/wizupapp.php ) (1 diff)
-
trunk/includes/class-wizup-admin.php (modified) (2 diffs)
-
trunk/includes/class-wizup-api.php (modified) (3 diffs)
-
trunk/includes/class-wizup-crm-webhook.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/views/admin-settings.php (modified) (1 diff)
-
trunk/wizupapp.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wizupapp/tags/1.0.2/includes/class-wizup-admin.php
r3612235 r3639204 357 357 if (isset($_POST['cwep_access_token']) && current_user_can('manage_options')) { 358 358 $token = sanitize_text_field(wp_unslash($_POST['cwep_access_token'])); 359 update_option('wizup_access_token', $token); 359 // Only update if it is not the masked placeholder value 360 if (!preg_match('/^\*+$/', $token)) { 361 if (empty($token)) { 362 delete_option('wizup_access_token'); 363 } else { 364 update_option('wizup_access_token', $token); 365 } 366 } 360 367 echo '<div class="updated"><p>' . esc_html__('Access token saved successfully.', 'wizupapp') . '</p></div>'; 361 368 } … … 370 377 $nonce = sanitize_text_field(wp_unslash($_POST['cwep_submit_whatsapp_button_nonce'])); 371 378 if (wp_verify_nonce($nonce, 'cwep_submit_whatsapp_button')) { 372 if (current_user_can('manage_options') && isset($_POST['wizup_show_product_whatsapp_button'])) { 373 $isChecked = sanitize_text_field(wp_unslash($_POST['wizup_show_product_whatsapp_button'])); 374 update_option('wizup_show_product_whatsapp_button', $isChecked); 379 if (current_user_can('manage_options')) { 380 update_option('wizup_show_product_whatsapp_button', isset($_POST['wizup_show_product_whatsapp_button']) ? 1 : 0); 375 381 } 376 382 if (isset($_POST['cwep_whatsapp_button_message_product']) && isset($_POST['cwep_whatsapp_button_message_general'])) { -
wizupapp/tags/1.0.2/includes/class-wizup-api.php
r3544452 r3639204 24 24 public function __construct() 25 25 { 26 // Register actions to fetch templates when token is saved 26 // Register actions to fetch templates when token is saved. 27 // update_option_* only fires when the option already exists and its 28 // value changes, so the very first save (add_option_*) needs its own hook. 29 add_action('add_option_wizup_access_token', array($this, 'fetch_templates_on_add'), 10, 2); 27 30 add_action('update_option_wizup_access_token', array($this, 'fetch_templates'), 10, 2); 31 } 32 33 /** 34 * Fetch templates the first time the access token option is created. 35 * 36 * @param string $option Option name. 37 * @param string $value Newly saved access token value. 38 * @return void 39 */ 40 public function fetch_templates_on_add($option, $value) 41 { 42 $this->fetch_templates(null, $value); 28 43 } 29 44 … … 44 59 'headers' => [ 45 60 'Authorization' => 'Bearer ' . $new_value, 46 ' Content-Type'=> 'application/json',61 'Accept' => 'application/json', 47 62 ], 63 'timeout' => 15, 48 64 ]); 49 65 50 if ( !is_wp_error($response)) {51 $body = wp_remote_retrieve_body($response);52 update_option('wizup_templates', json_decode($body, true));66 if (is_wp_error($response)) { 67 error_log('Wizup: failed to fetch templates - ' . $response->get_error_message()); 68 return; 53 69 } 70 71 $status_code = wp_remote_retrieve_response_code($response); 72 $body = wp_remote_retrieve_body($response); 73 74 if ($status_code !== 200) { 75 error_log(sprintf('Wizup: templates API returned HTTP %d - %s', $status_code, $body)); 76 return; 77 } 78 79 $templates = json_decode($body, true); 80 81 if (json_last_error() !== JSON_ERROR_NONE) { 82 error_log('Wizup: failed to decode templates response - ' . json_last_error_msg()); 83 return; 84 } 85 86 update_option('wizup_templates', $templates); 54 87 } 55 88 … … 66 99 $access_token = get_option('wizup_access_token'); 67 100 $templates = get_option('wizup_templates'); 68 $template_language = $this->get_template_language_code(json_decode($templates, true), $template_name); 101 $templates = is_array($templates) ? $templates : (array) json_decode((string) $templates, true); 102 $template_language = $this->get_template_language_code($templates, $template_name); 69 103 70 104 if (empty($access_token)) { -
wizupapp/tags/1.0.2/readme.txt
r3612235 r3639204 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 64 64 == Changelog == 65 65 = 1.0.1 = 66 * Updated Wizup Template APIs 67 * Fixed Whatsapp Embedded Button 68 69 = 1.0.1 = 66 70 * Add Webhook settings 67 71 * Auto WooCommerce order sync with Webhook -
wizupapp/tags/1.0.2/views/admin-settings.php
r3612235 r3639204 29 29 <th scope="row"><?php esc_html_e('Access Token', 'wizupapp'); ?></th> 30 30 <td> 31 <input type="text" name="cwep_access_token" id="wizup_access_token" 32 value="<?php echo esc_attr(get_option('wizup_access_token')); ?>" class="regular-text" /> 31 <?php 32 $saved_access_token = get_option('wizup_access_token'); 33 $display_access_token = !empty($saved_access_token) ? str_repeat('*', 32) : ''; 34 ?> 35 <input type="password" name="cwep_access_token" id="wizup_access_token" 36 value="<?php echo esc_attr($display_access_token); ?>" 37 class="regular-text" autocomplete="new-password" /> 33 38 <p class="description"> 34 39 <?php esc_html_e('Get this token from your Wizup dashboard.', 'wizupapp'); ?> -
wizupapp/tags/1.0.2/wizupapp.php
r3612235 r3639204 5 5 * Plugin URI: https://wizup.app/woocommerce-plugin 6 6 * Description: Integrates WooCommerce with wizup.app API to send WhatsApp messages for order notifications, status updates, abandoned carts, and more. 7 * Version: 1.0. 17 * Version: 1.0.2 8 8 * Author: wizupapp 9 9 * Author URI: https://wizup.app -
wizupapp/trunk/includes/class-wizup-admin.php
r3612235 r3639204 357 357 if (isset($_POST['cwep_access_token']) && current_user_can('manage_options')) { 358 358 $token = sanitize_text_field(wp_unslash($_POST['cwep_access_token'])); 359 update_option('wizup_access_token', $token); 359 // Only update if it is not the masked placeholder value 360 if (!preg_match('/^\*+$/', $token)) { 361 if (empty($token)) { 362 delete_option('wizup_access_token'); 363 } else { 364 update_option('wizup_access_token', $token); 365 } 366 } 360 367 echo '<div class="updated"><p>' . esc_html__('Access token saved successfully.', 'wizupapp') . '</p></div>'; 361 368 } … … 370 377 $nonce = sanitize_text_field(wp_unslash($_POST['cwep_submit_whatsapp_button_nonce'])); 371 378 if (wp_verify_nonce($nonce, 'cwep_submit_whatsapp_button')) { 372 if (current_user_can('manage_options') && isset($_POST['wizup_show_product_whatsapp_button'])) { 373 $isChecked = sanitize_text_field(wp_unslash($_POST['wizup_show_product_whatsapp_button'])); 374 update_option('wizup_show_product_whatsapp_button', $isChecked); 379 if (current_user_can('manage_options')) { 380 update_option('wizup_show_product_whatsapp_button', isset($_POST['wizup_show_product_whatsapp_button']) ? 1 : 0); 375 381 } 376 382 if (isset($_POST['cwep_whatsapp_button_message_product']) && isset($_POST['cwep_whatsapp_button_message_general'])) { -
wizupapp/trunk/includes/class-wizup-api.php
r3544452 r3639204 24 24 public function __construct() 25 25 { 26 // Register actions to fetch templates when token is saved 26 // Register actions to fetch templates when token is saved. 27 // update_option_* only fires when the option already exists and its 28 // value changes, so the very first save (add_option_*) needs its own hook. 29 add_action('add_option_wizup_access_token', array($this, 'fetch_templates_on_add'), 10, 2); 27 30 add_action('update_option_wizup_access_token', array($this, 'fetch_templates'), 10, 2); 31 } 32 33 /** 34 * Fetch templates the first time the access token option is created. 35 * 36 * @param string $option Option name. 37 * @param string $value Newly saved access token value. 38 * @return void 39 */ 40 public function fetch_templates_on_add($option, $value) 41 { 42 $this->fetch_templates(null, $value); 28 43 } 29 44 … … 44 59 'headers' => [ 45 60 'Authorization' => 'Bearer ' . $new_value, 46 ' Content-Type'=> 'application/json',61 'Accept' => 'application/json', 47 62 ], 63 'timeout' => 15, 48 64 ]); 49 65 50 if ( !is_wp_error($response)) {51 $body = wp_remote_retrieve_body($response);52 update_option('wizup_templates', json_decode($body, true));66 if (is_wp_error($response)) { 67 error_log('Wizup: failed to fetch templates - ' . $response->get_error_message()); 68 return; 53 69 } 70 71 $status_code = wp_remote_retrieve_response_code($response); 72 $body = wp_remote_retrieve_body($response); 73 74 if ($status_code !== 200) { 75 error_log(sprintf('Wizup: templates API returned HTTP %d - %s', $status_code, $body)); 76 return; 77 } 78 79 $templates = json_decode($body, true); 80 81 if (json_last_error() !== JSON_ERROR_NONE) { 82 error_log('Wizup: failed to decode templates response - ' . json_last_error_msg()); 83 return; 84 } 85 86 update_option('wizup_templates', $templates); 54 87 } 55 88 … … 66 99 $access_token = get_option('wizup_access_token'); 67 100 $templates = get_option('wizup_templates'); 68 $template_language = $this->get_template_language_code(json_decode($templates, true), $template_name); 101 $templates = is_array($templates) ? $templates : (array) json_decode((string) $templates, true); 102 $template_language = $this->get_template_language_code($templates, $template_name); 69 103 70 104 if (empty($access_token)) { -
wizupapp/trunk/readme.txt
r3612235 r3639204 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 64 64 == Changelog == 65 65 = 1.0.1 = 66 * Updated Wizup Template APIs 67 * Fixed Whatsapp Embedded Button 68 69 = 1.0.1 = 66 70 * Add Webhook settings 67 71 * Auto WooCommerce order sync with Webhook -
wizupapp/trunk/views/admin-settings.php
r3612235 r3639204 29 29 <th scope="row"><?php esc_html_e('Access Token', 'wizupapp'); ?></th> 30 30 <td> 31 <input type="text" name="cwep_access_token" id="wizup_access_token" 32 value="<?php echo esc_attr(get_option('wizup_access_token')); ?>" class="regular-text" /> 31 <?php 32 $saved_access_token = get_option('wizup_access_token'); 33 $display_access_token = !empty($saved_access_token) ? str_repeat('*', 32) : ''; 34 ?> 35 <input type="password" name="cwep_access_token" id="wizup_access_token" 36 value="<?php echo esc_attr($display_access_token); ?>" 37 class="regular-text" autocomplete="new-password" /> 33 38 <p class="description"> 34 39 <?php esc_html_e('Get this token from your Wizup dashboard.', 'wizupapp'); ?> -
wizupapp/trunk/wizupapp.php
r3612235 r3639204 5 5 * Plugin URI: https://wizup.app/woocommerce-plugin 6 6 * Description: Integrates WooCommerce with wizup.app API to send WhatsApp messages for order notifications, status updates, abandoned carts, and more. 7 * Version: 1.0. 17 * Version: 1.0.2 8 8 * Author: wizupapp 9 9 * Author URI: https://wizup.app
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)