Plugin Directory

Changeset 3387352


Ignore:
Timestamp:
10/30/2025 11:55:24 PM (4 months ago)
Author:
tulipwork
Message:

Mise à jour du plugin ATHS vers la version 2.7.3

Location:
add-to-home-screen-wp/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • add-to-home-screen-wp/trunk/add-to-home-screen-wp.php

    r3380293 r3387352  
    44Plugin URI: https://tulipemedia.com/en/add-to-home-screen-wordpress-plugin/
    55Description: 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.2
     6Version: 2.7.3
    77Author: Ziyad Bachalany
    88Author URI: https://tulipemedia.com
     
    4242            return [
    4343                'new_message_ios' => $is_network_activated
    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'),
     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'),
    4646                'new_message_android' => $is_network_activated
    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'),
     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'),
    4949                'new_startdelay' => 2,
    5050                'new_lifespan' => 20,
     
    7575            }
    7676
    77             $allowed_tags = ['%site_name%', '%network_name%', '%device%', '%icon%', '%add%'];
     77            $allowed_tags = ['{site_name}', '{network_name}', '{device}', '{icon}', '{add}'];
    7878            $placeholders = [];
    7979            foreach ($allowed_tags as $index => $tag) {
     
    362362                        <p class="description">
    363363                            <?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');
    365365                            if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) {
    366                                 echo esc_html__(', %network_name for the network name', 'add-to-home-screen-wp');
     366                                echo esc_html__(', {network_name} for the network name', 'add-to-home-screen-wp');
    367367                            }
     368                            echo ' ' . esc_html__('Note: Previously % placeholders were used (e.g., %site_name). Both % and {} are supported during transition.', 'add-to-home-screen-wp');
    368369                            ?>
    369370                        </p>
     
    376377                        <p class="description">
    377378                            <?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 %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                            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');
    379380                            if (is_multisite() && is_plugin_active_for_network(plugin_basename(__FILE__))) {
    380                                 echo esc_html__(', %network_name for the network name', 'add-to-home-screen-wp');
     381                                echo esc_html__(', {network_name} for the network name', 'add-to-home-screen-wp');
    381382                            }
     383                            echo ' ' . esc_html__('Note: Previously % placeholders were used (e.g., %site_name). Both % and {} are supported during transition.', 'add-to-home-screen-wp');
    382384                            ?>
    383385                        </p>
     
    612614                            <td>
    613615                                <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>
    615625                            </td>
    616626                        </tr>
     
    619629                            <td>
    620630                                <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>
    622640                            </td>
    623641                        </tr>
     
    10561074
    10571075    // 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);
    10611079    $message = preg_replace("(\r\n|\n|\r)", " ", $message);
    10621080
  • add-to-home-screen-wp/trunk/add2home.js

    r3287242 r3387352  
    178178        // Remplacer les placeholders %device, %icon et %add
    179179        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>'));
    183183        console.log('ATHSWP: Final message after replacements = ', finalMessage);
    184184
  • add-to-home-screen-wp/trunk/athswp-pwa.js

    r3326734 r3387352  
    7676            }
    7777
     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
    7890            let startY = 0;
    7991            let pullDistance = 0;
     
    8496
    8597            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
    88100                }
    89101                // Vérifier si l'utilisateur est presque au sommet de la page
     
    100112
    101113            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
    104116                }
    105117                if (!isPulling) return; // Sortir si le geste n'a pas commencé au sommet
  • add-to-home-screen-wp/trunk/readme.txt

    r3380293 r3387352  
    55Requires at least: 6.7
    66Tested up to: 6.8
    7 Stable tag: 2.7.2
     7Stable tag: 2.7.3
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    132132
    133133== Changelog ==
     134= 2.7.3 =
     135* **Improved**: Changed placeholders from % to {} in translatable strings for better compatibility with WordPress translation system.
     136
    134137= 2.7.2 =
    135138* **Fixed**: Fixed a broken link in the settings page.
     
    189192
    190193== Upgrade Notice ==
     194= 2.7.3 =
     195Changed placeholders from % to {} in translatable strings for better compatibility with WordPress translation system. Please update your messages in the plugin settings!
     196
    191197= 2.7.2 =
    192198Improved code structure and efficiency.
Note: See TracChangeset for help on using the changeset viewer.