Changeset 3387352
- Timestamp:
- 10/30/2025 11:55:24 PM (4 months ago)
- Location:
- add-to-home-screen-wp/trunk
- Files:
-
- 4 edited
-
add-to-home-screen-wp.php (modified) (8 diffs)
-
add2home.js (modified) (1 diff)
-
athswp-pwa.js (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
add-to-home-screen-wp/trunk/add-to-home-screen-wp.php
r3380293 r3387352 4 4 Plugin URI: https://tulipemedia.com/en/add-to-home-screen-wordpress-plugin/ 5 5 Description: Turn your WordPress site into a Web App (PWA) with a stylish 'Add to Home Screen' prompt for iOS & Android. Boost engagement without native app costs! 6 Version: 2.7. 26 Version: 2.7.3 7 7 Author: Ziyad Bachalany 8 8 Author URI: https://tulipemedia.com … … 42 42 return [ 43 43 'new_message_ios' => $is_network_activated 44 ? __('🚀 Add %network_name (%site_name) to your %device with %icon and %addnow! 🌟', 'add-to-home-screen-wp')45 : __('🚀 Add %site_name to your %device with %icon and %addnow! 🌟', 'add-to-home-screen-wp'),44 ? __('🚀 Add {network_name} ({site_name}) to your {device} with {icon} and {add} now! 🌟', 'add-to-home-screen-wp') 45 : __('🚀 Add {site_name} to your {device} with {icon} and {add} now! 🌟', 'add-to-home-screen-wp'), 46 46 'new_message_android' => $is_network_activated 47 ? __('🚀 Add %network_name (%site_name) to your %devicenow! 🌟', 'add-to-home-screen-wp')48 : __('🚀 Add %site_name to your %devicenow! 🌟', 'add-to-home-screen-wp'),47 ? __('🚀 Add {network_name} ({site_name}) to your {device} now! 🌟', 'add-to-home-screen-wp') 48 : __('🚀 Add {site_name} to your {device} now! 🌟', 'add-to-home-screen-wp'), 49 49 'new_startdelay' => 2, 50 50 'new_lifespan' => 20, … … 75 75 } 76 76 77 $allowed_tags = [' %site_name%', '%network_name%', '%device%', '%icon%', '%add%'];77 $allowed_tags = ['{site_name}', '{network_name}', '{device}', '{icon}', '{add}']; 78 78 $placeholders = []; 79 79 foreach ($allowed_tags as $index => $tag) { … … 362 362 <p class="description"> 363 363 <?php 364 esc_html_e('Custom message for iOS devices. Use %site_name for the site name, %device for the user\'s device, %icon for the first add icon, and %add for the second add icon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp');364 esc_html_e('Custom message for iOS devices. Use {site_name} for the site name, {device} for the user\'s device, {icon} for the first add icon, and {add} for the second add icon.', 'add-to-home-screen-wp'); 365 365 if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) { 366 echo esc_html__(', %network_namefor the network name', 'add-to-home-screen-wp');366 echo esc_html__(', {network_name} for the network name', 'add-to-home-screen-wp'); 367 367 } 368 echo ' ' . esc_html__('Note: Previously % placeholders were used (e.g., %site_name). Both % and {} are supported during transition.', 'add-to-home-screen-wp'); 368 369 ?> 369 370 </p> … … 376 377 <p class="description"> 377 378 <?php 378 esc_html_e('Custom message for Android devices. Use %site_name for the site name, and %device for the user\'s device. Note: %icon and %addare not supported in the Android balloon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp');379 esc_html_e('Custom message for Android devices. Use {site_name} for the site name, and {device} for the user\'s device. Note: {icon} and {add} are not supported in the Android balloon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp'); 379 380 if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) { 380 echo esc_html__(', %network_namefor the network name', 'add-to-home-screen-wp');381 echo esc_html__(', {network_name} for the network name', 'add-to-home-screen-wp'); 381 382 } 383 echo ' ' . esc_html__('Note: Previously % placeholders were used (e.g., %site_name). Both % and {} are supported during transition.', 'add-to-home-screen-wp'); 382 384 ?> 383 385 </p> … … 612 614 <td> 613 615 <textarea rows="3" cols="50" name="new_message_ios" id="new_message_ios" placeholder="<?php echo esc_attr($defaults['new_message_ios']); ?>"><?php echo esc_textarea($settings['new_message_ios']); ?></textarea> 614 <p class="description"><?php esc_html_e('Custom message for iOS devices. Use %site_name for the site name, %device for the user\'s device, %icon for the first add icon, and %add for the second add icon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp'); ?></p> 616 <p class="description"> 617 <?php 618 esc_html_e('Custom message for iOS devices. Use {site_name} for the site name, {device} for the user\'s device, {icon} for the first add icon, and {add} for the second add icon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp'); 619 if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) { 620 echo esc_html__(', {network_name} for the network name', 'add-to-home-screen-wp'); 621 } 622 echo ' ' . esc_html__('Note: Previously % placeholders were used (e.g., %site_name). Both % and {} are supported during transition.', 'add-to-home-screen-wp'); 623 ?> 624 </p> 615 625 </td> 616 626 </tr> … … 619 629 <td> 620 630 <textarea rows="3" cols="50" name="new_message_android" id="new_message_android" placeholder="<?php echo esc_attr($defaults['new_message_android']); ?>"><?php echo esc_textarea($settings['new_message_android']); ?></textarea> 621 <p class="description"><?php esc_html_e('Custom message for Android devices. Use %site_name for the site name, and %device for the user\'s device. Note: %icon and %add are not supported in the Android balloon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp'); ?></p> 631 <p class="description"> 632 <?php 633 esc_html_e('Custom message for Android devices. Use {site_name} for the site name, and {device} for the user\'s device. Note: {icon} and {add} are not supported in the Android balloon. Supports basic HTML (e.g., <strong>, <i>). If empty, the default message will be used.', 'add-to-home-screen-wp'); 634 if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) { 635 echo esc_html__(', {network_name} for the network name', 'add-to-home-screen-wp'); 636 } 637 echo ' ' . esc_html__('Note: Previously % placeholders were used (e.g., %site_name). Both % and {} are supported during transition.', 'add-to-home-screen-wp'); 638 ?> 639 </p> 622 640 </td> 623 641 </tr> … … 1056 1074 1057 1075 // Replace placeholders 1058 $message = str_replace(' %site_name', esc_html(get_bloginfo('name')), $message);1059 $message = str_replace(' %network_name', esc_html(is_multisite() ? get_network()->site_name : get_bloginfo('name')), $message);1060 $message = str_replace(' %device', $is_ios ? 'iPhone' : 'Android', $message);1076 $message = str_replace('{site_name}', esc_html(get_bloginfo('name')), $message); 1077 $message = str_replace('{network_name}', esc_html(is_multisite() ? get_network()->site_name : get_bloginfo('name')), $message); 1078 $message = str_replace('{device}', $is_ios ? 'iPhone' : 'Android', $message); 1061 1079 $message = preg_replace("(\r\n|\n|\r)", " ", $message); 1062 1080 -
add-to-home-screen-wp/trunk/add2home.js
r3287242 r3387352 178 178 // Remplacer les placeholders %device, %icon et %add 179 179 var finalMessage = message 180 .replace( '%device', platform)181 .replace( '%add', OSVersion >= 4.2 || isMobileChrome ? '<span class="addToHomeadd"></span>' : '<span class="addToHomePlus">+</span>')182 .replace( '%icon', isMobileChrome ? '' : (OSVersion >= 4.2 ? '<span class="addToHomeShare"></span>' : '<span class="addToHomePlus">+</span>'));180 .replace(/{device}/g, platform) 181 .replace(/{add}/g, OSVersion >= 4.2 || isMobileChrome ? '<span class="addToHomeadd"></span>' : '<span class="addToHomePlus">+</span>') 182 .replace(/{icon}/g, isMobileChrome ? '' : (OSVersion >= 4.2 ? '<span class="addToHomeShare"></span>' : '<span class="addToHomePlus">+</span>')); 183 183 console.log('ATHSWP: Final message after replacements = ', finalMessage); 184 184 -
add-to-home-screen-wp/trunk/athswp-pwa.js
r3326734 r3387352 76 76 } 77 77 78 // Vérifier si le target est dans un élément éditable 79 function isInEditable(target) { 80 while (target) { 81 const tagName = target.tagName.toUpperCase(); 82 if (['INPUT', 'TEXTAREA'].includes(tagName) || target.contentEditable === 'true') { 83 return true; 84 } 85 target = target.parentNode; 86 } 87 return false; 88 } 89 78 90 let startY = 0; 79 91 let pullDistance = 0; … … 84 96 85 97 document.addEventListener('touchstart', function(e) { 86 if (isInSidebar(e.target) ) {87 return; // Ignore si geste commence dans la sidebar 98 if (isInSidebar(e.target) || isInEditable(e.target)) { 99 return; // Ignore si geste commence dans la sidebar ou dans un élément éditable 88 100 } 89 101 // Vérifier si l'utilisateur est presque au sommet de la page … … 100 112 101 113 document.addEventListener('touchmove', function(e) { 102 if (isInSidebar(e.target) ) {103 return; // Ignore si geste se déplace dans la sidebar 114 if (isInSidebar(e.target) || isInEditable(e.target)) { 115 return; // Ignore si geste se déplace dans la sidebar ou dans un élément éditable 104 116 } 105 117 if (!isPulling) return; // Sortir si le geste n'a pas commencé au sommet -
add-to-home-screen-wp/trunk/readme.txt
r3380293 r3387352 5 5 Requires at least: 6.7 6 6 Tested up to: 6.8 7 Stable tag: 2.7. 27 Stable tag: 2.7.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 132 132 133 133 == Changelog == 134 = 2.7.3 = 135 * **Improved**: Changed placeholders from % to {} in translatable strings for better compatibility with WordPress translation system. 136 134 137 = 2.7.2 = 135 138 * **Fixed**: Fixed a broken link in the settings page. … … 189 192 190 193 == Upgrade Notice == 194 = 2.7.3 = 195 Changed placeholders from % to {} in translatable strings for better compatibility with WordPress translation system. Please update your messages in the plugin settings! 196 191 197 = 2.7.2 = 192 198 Improved code structure and efficiency.
Note: See TracChangeset
for help on using the changeset viewer.