Plugin Directory

Changeset 3823148


Ignore:
Timestamp:
11/25/2026 02:55:19 PM (90 minutes ago)
Author:
farazify
Message:

Update Floating Action Button to 1.4.0.

Add device visibility, edge distance, button sizes, and a WhatsApp greeting.

Location:
floating-action-button
Files:
6 edited
10 copied

Legend:

Unmodified
Added
Removed
  • floating-action-button/tags/1.4.0/assets/admin-script.js

    r3823106 r3823148  
    116116                                position: $("#fz-fab-position").val(),
    117117                                type: $("#fz-fab-type").val(),
     118                                display_on_mobile: $("#fz-fab-display-mobile").is(":checked") ? "TRUE" : "FALSE",
     119                                display_on_tablet: $("#fz-fab-display-tablet").is(":checked") ? "TRUE" : "FALSE",
     120                                display_on_desktop: $("#fz-fab-display-desktop").is(":checked") ? "TRUE" : "FALSE",
     121                                margin: $("#fz-fab-margin").val(),
     122                                main_size: $("#fz-fab-main-size").val(),
     123                                sub_size: $("#fz-fab-sub-size").val(),
     124                                wa_message: $("#fz-fab-wa-message").val(),
    118125                                m_img_id: $("#fz-fab-main-btn-icon").data("id"),
    119126                                m_color: $("#fz-fab-main-btn-color").val().trim(),
  • floating-action-button/tags/1.4.0/index.php

    r3823106 r3823148  
    44 * Plugin URI: http://okapitech.in/wordpress-plugin-floating-action-button
    55 * Description: Display the beautiful FAB (Floating Action Button) on your WordPress front-end.
    6  * Version: 1.3.0
     6 * Version: 1.4.0
    77 * Requires at least: 4.6
    88 * Requires PHP: 7.4
    … …  
    1919defined('ABSPATH') || exit;
    2020
    21 define('FZ_FAB_VERSION', '1.3.0');
     21define('FZ_FAB_VERSION', '1.4.0');
    2222define('FZ_FAB_PLUGIN_URL', plugin_dir_url(__FILE__));
    2323define('FZ_FAB_PLUGIN_PATH', plugin_dir_path(__FILE__));
    … …  
    221221        }
    222222
     223        $mobile  = (isset($_POST['display_on_mobile']) && wp_unslash($_POST['display_on_mobile']) === 'TRUE') ? 'TRUE' : 'FALSE';
     224        $tablet  = (isset($_POST['display_on_tablet']) && wp_unslash($_POST['display_on_tablet']) === 'TRUE') ? 'TRUE' : 'FALSE';
     225        $desktop = (isset($_POST['display_on_desktop']) && wp_unslash($_POST['display_on_desktop']) === 'TRUE') ? 'TRUE' : 'FALSE';
     226        $margin  = isset($_POST['margin']) ? fz_fab_px(wp_unslash($_POST['margin']), 15, 0, 400) : 15;
     227        $main_size = isset($_POST['main_size']) ? fz_fab_px(wp_unslash($_POST['main_size']), 64, 40, 160) : 64;
     228        $sub_size  = isset($_POST['sub_size']) ? fz_fab_px(wp_unslash($_POST['sub_size']), 48, 32, 128) : 48;
     229        $wa_message = isset($_POST['wa_message']) ? sanitize_text_field(wp_unslash($_POST['wa_message'])) : 'Hi';
     230
    223231        $image_id = isset($_POST['m_img_id']) ? absint(wp_unslash($_POST['m_img_id'])) : 0;
    224232        $color    = isset($_POST['m_color']) ? sanitize_hex_color(wp_unslash($_POST['m_color'])) : '';
    … …  
    244252        update_option('fz_fab_position', $position, true);
    245253        update_option('fz_fab_type', $type, true);
     254        update_option('fz_fab_display_on_mobile', $mobile, true);
     255        update_option('fz_fab_display_on_tablet', $tablet, true);
     256        update_option('fz_fab_display_on_desktop', $desktop, true);
     257        update_option('fz_fab_margin', (string) $margin, true);
     258        update_option('fz_fab_main_size', (string) $main_size, true);
     259        update_option('fz_fab_sub_size', (string) $sub_size, true);
     260        update_option('fz_fab_wa_message', $wa_message, true);
    246261        update_option('fz_fab_main_img_id', (string) $image_id, true);
    247262        update_option('fz_fab_main_color', $color, true);
    … …  
    296311
    297312/**
    298  * Remove the internal field separator from a saved value.
    299  *
    300  * @param string $value Raw value.
    301  * @return string
    302  */
     313 * Keep a pixel setting inside a safe range.
     314 *
     315 * @param mixed $value   Candidate.
     316 * @param int   $default Fallback.
     317 * @param int   $min     Minimum.
     318 * @param int   $max     Maximum.
     319 * @return int
     320 */
     321function fz_fab_px($value, $default, $min, $max) {
     322        $value = absint($value);
     323        if ($value < $min || $value > $max) {
     324                return (int) $default;
     325        }
     326        return $value;
     327}
     328
    303329function fz_fab_strip_delimiter($value) {
    304330        return str_replace('@ELFIN@', '', (string) $value);
  • floating-action-button/tags/1.4.0/readme.txt

    r3823106 r3823148  
    55Requires at least: 4.6
    66Tested up to: 7.1
    7 Stable tag: 1.3.0
     7Stable tag: 1.4.0
    88Requires PHP: 7.4
    99License: GPLv2 or later
    … …  
    32322. Change the Position of Floating Action Button to Top-Left/Top-Right/Bottom-Left/Bottom-Right
    33333. Option to Trigger Button by Mouse-Click or Mouse-Hover
     344. Show or hide the button on phone, tablet, and desktop
     355. Set the distance from the screen edge
     366. Set the main button size and the sub button size
     377. Set the WhatsApp greeting that opens in the chat
    3438
    3539* Main Button Settings
    … …  
    8387You can use WhatsApp number like that 919806886806 (with country code but without any plus, preceding zero, hyphen, brackets, space)
    8488
     89= Where do I change the WhatsApp greeting? =
     90
     91Use Basic Settings > WhatsApp greeting. That text is prefilled when a visitor opens WhatsApp. Leave it blank to open WhatsApp without a message.
     92
    8593= Which value can I use for the content field of Facebook Messenger Button? =
    8694
    … …  
    120128== Changelog ==
    121129
     130= 1.4.0 =
     131* Choose phone, tablet, and desktop visibility.
     132* Set the distance from the screen edge.
     133* Set the main button size and the sub button size.
     134* Set the WhatsApp greeting message.
     135
    122136= 1.3.0 =
    123137* Tested with WordPress 7.1 and PHP 7.4 through 8.5.
    … …  
    146160== Upgrade Notice ==
    147161
     162= 1.4.0 =
     163Adds device visibility, button size, edge distance, and a WhatsApp greeting.
     164
    148165= 1.3.0 =
    149166Tested with WordPress 7.1. Includes display fixes and safer settings handling. Requires PHP 7.4.
  • floating-action-button/tags/1.4.0/uninstall.php

    r3823106 r3823148  
    1313delete_option('fz_fab_position');
    1414delete_option('fz_fab_type');
     15delete_option('fz_fab_display_on_mobile');
     16delete_option('fz_fab_display_on_tablet');
     17delete_option('fz_fab_display_on_desktop');
     18delete_option('fz_fab_margin');
     19delete_option('fz_fab_main_size');
     20delete_option('fz_fab_sub_size');
     21delete_option('fz_fab_wa_message');
    1522delete_option('fz_fab_main_img_id');
    1623delete_option('fz_fab_main_color');
  • floating-action-button/tags/1.4.0/views/fab-button.php

    r3823106 r3823148  
    1212        $position = '3';
    1313}
     14
     15$on_mobile  = (string) get_option('fz_fab_display_on_mobile', 'TRUE') === 'TRUE';
     16$on_tablet  = (string) get_option('fz_fab_display_on_tablet', 'TRUE') === 'TRUE';
     17$on_desktop = (string) get_option('fz_fab_display_on_desktop', 'TRUE') === 'TRUE';
     18$edge       = fz_fab_px(get_option('fz_fab_margin', 15), 15, 0, 400);
     19$main_size  = fz_fab_px(get_option('fz_fab_main_size', 64), 64, 40, 160);
     20$sub_size   = fz_fab_px(get_option('fz_fab_sub_size', 48), 48, 32, 128);
     21$wa_message = (string) get_option('fz_fab_wa_message', 'Hi');
    1422
    1523$main_img_id   = absint(get_option('fz_fab_main_img_id', 0));
    … …  
    4452        }
    4553        .fz-fab-box{
    46                 top: 15px !important;
    47                 left: 15px !important;
     54                top: <?php echo (int) $edge; ?>px !important;
     55                left: <?php echo (int) $edge; ?>px !important;
    4856        }
    4957<?php elseif ($position === '2') : ?>
    … …  
    5866        }
    5967        .fz-fab-box{
    60                 top: 15px !important;
    61                 right: 15px !important;
     68                top: <?php echo (int) $edge; ?>px !important;
     69                right: <?php echo (int) $edge; ?>px !important;
    6270        }
    6371<?php elseif ($position === '4') : ?>
    … …  
    7280        }
    7381        .fz-fab-box{
    74                 bottom: 15px !important;
    75                 left: 15px !important;
     82                bottom: <?php echo (int) $edge; ?>px !important;
     83                left: <?php echo (int) $edge; ?>px !important;
    7684        }
    7785<?php else : ?>
    … …  
    8694        }
    8795        .fz-fab-box{
    88                 bottom: 15px !important;
    89                 right: 15px !important;
     96                bottom: <?php echo (int) $edge; ?>px !important;
     97                right: <?php echo (int) $edge; ?>px !important;
    9098        }
    9199<?php endif; ?>
    92100.fz-fab-container{
    93101        position: fixed !important;
    94         margin: 1em !important;
     102        margin: <?php echo (int) $edge; ?>px !important;
    95103        z-index: 999999999 !important;
    96104}
    … …  
    104112        border-radius: 100% !important;
    105113        display: block !important;
    106         width: 64px !important;
    107         height: 64px !important;
     114        width: <?php echo (int) $main_size; ?>px !important;
     115        height: <?php echo (int) $main_size; ?>px !important;
    108116        margin: 10px auto 0 !important;
    109117        position: relative !important;
    … …  
    116124.fz-fab-buttons.fz-fab-primary img{
    117125        border-radius: 50% !important;
    118         width: 64px !important;
    119         height: 64px !important;
     126        width: <?php echo (int) $main_size; ?>px !important;
     127        height: <?php echo (int) $main_size; ?>px !important;
    120128}
    121129.fz-fab-buttons.fz-fab-secondary{
    … …  
    123131        border-radius: 100% !important;
    124132        display: block !important;
    125         width: 48px !important;
    126         height: 48px !important;
     133        width: <?php echo (int) $sub_size; ?>px !important;
     134        height: <?php echo (int) $sub_size; ?>px !important;
    127135        margin: auto !important;
    128136        position: relative !important;
    … …  
    136144}
    137145.fz-fab-buttons.fz-fab-secondary img{
    138         width: 48px !important;
    139         height: 48px !important;
     146        width: <?php echo (int) $sub_size; ?>px !important;
     147        height: <?php echo (int) $sub_size; ?>px !important;
    140148        border-radius: 50% !important;
    141149}
    … …  
    192200.fz-fab-box-hide:hover{
    193201        opacity: 1 !important;
     202}
     203@media only screen and (min-width: 320px) and (max-width: 767px){
     204<?php if (!$on_mobile) : ?>
     205        .fz-fab-container,
     206        .fz-fab-box{
     207                display: none !important;
     208        }
     209<?php endif; ?>
     210}
     211@media only screen and (min-width: 768px) and (max-width: 991px){
     212<?php if (!$on_tablet) : ?>
     213        .fz-fab-container,
     214        .fz-fab-box{
     215                display: none !important;
     216        }
     217<?php endif; ?>
     218}
     219@media only screen and (min-width: 992px){
     220<?php if (!$on_desktop) : ?>
     221        .fz-fab-container,
     222        .fz-fab-box{
     223                display: none !important;
     224        }
     225<?php endif; ?>
    194226}
    195227</style>
    … …  
    260292                                <?php
    261293                                $number = preg_replace('/\D+/', '', $content);
    262                                 $whatsapp_url = 'https://wa.me/' . rawurlencode($number) . '?text=' . rawurlencode('Hi');
     294                                $whatsapp_url = 'https://wa.me/' . rawurlencode($number) . '?text=' . rawurlencode($wa_message);
    263295                                ?>
    264296                                <div style="display: block; margin-bottom: 32px; text-align: center; font-size: 16px; font-weight: bold;">
  • floating-action-button/tags/1.4.0/views/settings.php

    r3823106 r3823148  
    1111$position      = get_option('fz_fab_position', '3');
    1212$type          = get_option('fz_fab_type', '1');
     13$on_mobile     = get_option('fz_fab_display_on_mobile', 'TRUE');
     14$on_tablet     = get_option('fz_fab_display_on_tablet', 'TRUE');
     15$on_desktop    = get_option('fz_fab_display_on_desktop', 'TRUE');
     16$margin        = fz_fab_px(get_option('fz_fab_margin', 15), 15, 0, 400);
     17$main_size     = fz_fab_px(get_option('fz_fab_main_size', 64), 64, 40, 160);
     18$sub_size      = fz_fab_px(get_option('fz_fab_sub_size', 48), 48, 32, 128);
     19$wa_message    = get_option('fz_fab_wa_message', 'Hi');
    1320$main_img_id   = absint(get_option('fz_fab_main_img_id', 0));
    1421$main_color    = fz_fab_hex_or_default(get_option('fz_fab_main_color', FZ_FAB_COLOR), FZ_FAB_COLOR);
    … …  
    7683                                </td>
    7784                        </tr>
     85                        <tr>
     86                                <td class="fz-td-1">
     87                                        <?php esc_html_e('Display on', 'floating-action-button'); ?>
     88                                </td>
     89                                <td>
     90                                        <label style="display: block;">
     91                                                <input id="fz-fab-display-mobile" type="checkbox" value="TRUE" <?php checked((string) $on_mobile, 'TRUE'); ?>>
     92                                                <?php esc_html_e('Phone', 'floating-action-button'); ?>
     93                                        </label>
     94                                        <label style="display: block;">
     95                                                <input id="fz-fab-display-tablet" type="checkbox" value="TRUE" <?php checked((string) $on_tablet, 'TRUE'); ?>>
     96                                                <?php esc_html_e('Tablet', 'floating-action-button'); ?>
     97                                        </label>
     98                                        <label style="display: block;">
     99                                                <input id="fz-fab-display-desktop" type="checkbox" value="TRUE" <?php checked((string) $on_desktop, 'TRUE'); ?>>
     100                                                <?php esc_html_e('Desktop', 'floating-action-button'); ?>
     101                                        </label>
     102                                </td>
     103                        </tr>
     104                        <tr>
     105                                <td class="fz-td-1">
     106                                        <?php esc_html_e('Distance from edge', 'floating-action-button'); ?>
     107                                </td>
     108                                <td>
     109                                        <input id="fz-fab-margin" class="fz-form-element" type="number" min="0" max="400" value="<?php echo esc_attr($margin); ?>">
     110                                        <small class="fz-fab-small"><?php esc_html_e('In pixels', 'floating-action-button'); ?></small>
     111                                </td>
     112                        </tr>
     113                        <tr>
     114                                <td class="fz-td-1">
     115                                        <?php esc_html_e('Main button size', 'floating-action-button'); ?>
     116                                </td>
     117                                <td>
     118                                        <input id="fz-fab-main-size" class="fz-form-element" type="number" min="40" max="160" value="<?php echo esc_attr($main_size); ?>">
     119                                        <small class="fz-fab-small"><?php esc_html_e('In pixels. Default 64.', 'floating-action-button'); ?></small>
     120                                </td>
     121                        </tr>
     122                        <tr>
     123                                <td class="fz-td-1">
     124                                        <?php esc_html_e('Sub button size', 'floating-action-button'); ?>
     125                                </td>
     126                                <td>
     127                                        <input id="fz-fab-sub-size" class="fz-form-element" type="number" min="32" max="128" value="<?php echo esc_attr($sub_size); ?>">
     128                                        <small class="fz-fab-small"><?php esc_html_e('In pixels. Default 48.', 'floating-action-button'); ?></small>
     129                                </td>
     130                        </tr>
     131                        <tr>
     132                                <td class="fz-td-1">
     133                                        <?php esc_html_e('WhatsApp greeting', 'floating-action-button'); ?>
     134                                </td>
     135                                <td>
     136                                        <input id="fz-fab-wa-message" class="fz-form-element" type="text" value="<?php echo esc_attr($wa_message); ?>">
     137                                        <small class="fz-fab-small"><?php esc_html_e('Message that opens in WhatsApp. Leave blank for no message.', 'floating-action-button'); ?></small>
     138                                </td>
     139                        </tr>
    78140                </tbody>
    79141        </table>
  • floating-action-button/trunk/assets/admin-script.js

    r3823106 r3823148  
    116116                                position: $("#fz-fab-position").val(),
    117117                                type: $("#fz-fab-type").val(),
     118                                display_on_mobile: $("#fz-fab-display-mobile").is(":checked") ? "TRUE" : "FALSE",
     119                                display_on_tablet: $("#fz-fab-display-tablet").is(":checked") ? "TRUE" : "FALSE",
     120                                display_on_desktop: $("#fz-fab-display-desktop").is(":checked") ? "TRUE" : "FALSE",
     121                                margin: $("#fz-fab-margin").val(),
     122                                main_size: $("#fz-fab-main-size").val(),
     123                                sub_size: $("#fz-fab-sub-size").val(),
     124                                wa_message: $("#fz-fab-wa-message").val(),
    118125                                m_img_id: $("#fz-fab-main-btn-icon").data("id"),
    119126                                m_color: $("#fz-fab-main-btn-color").val().trim(),
  • floating-action-button/trunk/index.php

    r3823106 r3823148  
    44 * Plugin URI: http://okapitech.in/wordpress-plugin-floating-action-button
    55 * Description: Display the beautiful FAB (Floating Action Button) on your WordPress front-end.
    6  * Version: 1.3.0
     6 * Version: 1.4.0
    77 * Requires at least: 4.6
    88 * Requires PHP: 7.4
    … …  
    1919defined('ABSPATH') || exit;
    2020
    21 define('FZ_FAB_VERSION', '1.3.0');
     21define('FZ_FAB_VERSION', '1.4.0');
    2222define('FZ_FAB_PLUGIN_URL', plugin_dir_url(__FILE__));
    2323define('FZ_FAB_PLUGIN_PATH', plugin_dir_path(__FILE__));
    … …  
    221221        }
    222222
     223        $mobile  = (isset($_POST['display_on_mobile']) && wp_unslash($_POST['display_on_mobile']) === 'TRUE') ? 'TRUE' : 'FALSE';
     224        $tablet  = (isset($_POST['display_on_tablet']) && wp_unslash($_POST['display_on_tablet']) === 'TRUE') ? 'TRUE' : 'FALSE';
     225        $desktop = (isset($_POST['display_on_desktop']) && wp_unslash($_POST['display_on_desktop']) === 'TRUE') ? 'TRUE' : 'FALSE';
     226        $margin  = isset($_POST['margin']) ? fz_fab_px(wp_unslash($_POST['margin']), 15, 0, 400) : 15;
     227        $main_size = isset($_POST['main_size']) ? fz_fab_px(wp_unslash($_POST['main_size']), 64, 40, 160) : 64;
     228        $sub_size  = isset($_POST['sub_size']) ? fz_fab_px(wp_unslash($_POST['sub_size']), 48, 32, 128) : 48;
     229        $wa_message = isset($_POST['wa_message']) ? sanitize_text_field(wp_unslash($_POST['wa_message'])) : 'Hi';
     230
    223231        $image_id = isset($_POST['m_img_id']) ? absint(wp_unslash($_POST['m_img_id'])) : 0;
    224232        $color    = isset($_POST['m_color']) ? sanitize_hex_color(wp_unslash($_POST['m_color'])) : '';
    … …  
    244252        update_option('fz_fab_position', $position, true);
    245253        update_option('fz_fab_type', $type, true);
     254        update_option('fz_fab_display_on_mobile', $mobile, true);
     255        update_option('fz_fab_display_on_tablet', $tablet, true);
     256        update_option('fz_fab_display_on_desktop', $desktop, true);
     257        update_option('fz_fab_margin', (string) $margin, true);
     258        update_option('fz_fab_main_size', (string) $main_size, true);
     259        update_option('fz_fab_sub_size', (string) $sub_size, true);
     260        update_option('fz_fab_wa_message', $wa_message, true);
    246261        update_option('fz_fab_main_img_id', (string) $image_id, true);
    247262        update_option('fz_fab_main_color', $color, true);
    … …  
    296311
    297312/**
    298  * Remove the internal field separator from a saved value.
    299  *
    300  * @param string $value Raw value.
    301  * @return string
    302  */
     313 * Keep a pixel setting inside a safe range.
     314 *
     315 * @param mixed $value   Candidate.
     316 * @param int   $default Fallback.
     317 * @param int   $min     Minimum.
     318 * @param int   $max     Maximum.
     319 * @return int
     320 */
     321function fz_fab_px($value, $default, $min, $max) {
     322        $value = absint($value);
     323        if ($value < $min || $value > $max) {
     324                return (int) $default;
     325        }
     326        return $value;
     327}
     328
    303329function fz_fab_strip_delimiter($value) {
    304330        return str_replace('@ELFIN@', '', (string) $value);
  • floating-action-button/trunk/readme.txt

    r3823106 r3823148  
    55Requires at least: 4.6
    66Tested up to: 7.1
    7 Stable tag: 1.3.0
     7Stable tag: 1.4.0
    88Requires PHP: 7.4
    99License: GPLv2 or later
    … …  
    32322. Change the Position of Floating Action Button to Top-Left/Top-Right/Bottom-Left/Bottom-Right
    33333. Option to Trigger Button by Mouse-Click or Mouse-Hover
     344. Show or hide the button on phone, tablet, and desktop
     355. Set the distance from the screen edge
     366. Set the main button size and the sub button size
     377. Set the WhatsApp greeting that opens in the chat
    3438
    3539* Main Button Settings
    … …  
    8387You can use WhatsApp number like that 919806886806 (with country code but without any plus, preceding zero, hyphen, brackets, space)
    8488
     89= Where do I change the WhatsApp greeting? =
     90
     91Use Basic Settings > WhatsApp greeting. That text is prefilled when a visitor opens WhatsApp. Leave it blank to open WhatsApp without a message.
     92
    8593= Which value can I use for the content field of Facebook Messenger Button? =
    8694
    … …  
    120128== Changelog ==
    121129
     130= 1.4.0 =
     131* Choose phone, tablet, and desktop visibility.
     132* Set the distance from the screen edge.
     133* Set the main button size and the sub button size.
     134* Set the WhatsApp greeting message.
     135
    122136= 1.3.0 =
    123137* Tested with WordPress 7.1 and PHP 7.4 through 8.5.
    … …  
    146160== Upgrade Notice ==
    147161
     162= 1.4.0 =
     163Adds device visibility, button size, edge distance, and a WhatsApp greeting.
     164
    148165= 1.3.0 =
    149166Tested with WordPress 7.1. Includes display fixes and safer settings handling. Requires PHP 7.4.
  • floating-action-button/trunk/uninstall.php

    r3823106 r3823148  
    1313delete_option('fz_fab_position');
    1414delete_option('fz_fab_type');
     15delete_option('fz_fab_display_on_mobile');
     16delete_option('fz_fab_display_on_tablet');
     17delete_option('fz_fab_display_on_desktop');
     18delete_option('fz_fab_margin');
     19delete_option('fz_fab_main_size');
     20delete_option('fz_fab_sub_size');
     21delete_option('fz_fab_wa_message');
    1522delete_option('fz_fab_main_img_id');
    1623delete_option('fz_fab_main_color');
  • floating-action-button/trunk/views/fab-button.php

    r3823106 r3823148  
    1212        $position = '3';
    1313}
     14
     15$on_mobile  = (string) get_option('fz_fab_display_on_mobile', 'TRUE') === 'TRUE';
     16$on_tablet  = (string) get_option('fz_fab_display_on_tablet', 'TRUE') === 'TRUE';
     17$on_desktop = (string) get_option('fz_fab_display_on_desktop', 'TRUE') === 'TRUE';
     18$edge       = fz_fab_px(get_option('fz_fab_margin', 15), 15, 0, 400);
     19$main_size  = fz_fab_px(get_option('fz_fab_main_size', 64), 64, 40, 160);
     20$sub_size   = fz_fab_px(get_option('fz_fab_sub_size', 48), 48, 32, 128);
     21$wa_message = (string) get_option('fz_fab_wa_message', 'Hi');
    1422
    1523$main_img_id   = absint(get_option('fz_fab_main_img_id', 0));
    … …  
    4452        }
    4553        .fz-fab-box{
    46                 top: 15px !important;
    47                 left: 15px !important;
     54                top: <?php echo (int) $edge; ?>px !important;
     55                left: <?php echo (int) $edge; ?>px !important;
    4856        }
    4957<?php elseif ($position === '2') : ?>
    … …  
    5866        }
    5967        .fz-fab-box{
    60                 top: 15px !important;
    61                 right: 15px !important;
     68                top: <?php echo (int) $edge; ?>px !important;
     69                right: <?php echo (int) $edge; ?>px !important;
    6270        }
    6371<?php elseif ($position === '4') : ?>
    … …  
    7280        }
    7381        .fz-fab-box{
    74                 bottom: 15px !important;
    75                 left: 15px !important;
     82                bottom: <?php echo (int) $edge; ?>px !important;
     83                left: <?php echo (int) $edge; ?>px !important;
    7684        }
    7785<?php else : ?>
    … …  
    8694        }
    8795        .fz-fab-box{
    88                 bottom: 15px !important;
    89                 right: 15px !important;
     96                bottom: <?php echo (int) $edge; ?>px !important;
     97                right: <?php echo (int) $edge; ?>px !important;
    9098        }
    9199<?php endif; ?>
    92100.fz-fab-container{
    93101        position: fixed !important;
    94         margin: 1em !important;
     102        margin: <?php echo (int) $edge; ?>px !important;
    95103        z-index: 999999999 !important;
    96104}
    … …  
    104112        border-radius: 100% !important;
    105113        display: block !important;
    106         width: 64px !important;
    107         height: 64px !important;
     114        width: <?php echo (int) $main_size; ?>px !important;
     115        height: <?php echo (int) $main_size; ?>px !important;
    108116        margin: 10px auto 0 !important;
    109117        position: relative !important;
    … …  
    116124.fz-fab-buttons.fz-fab-primary img{
    117125        border-radius: 50% !important;
    118         width: 64px !important;
    119         height: 64px !important;
     126        width: <?php echo (int) $main_size; ?>px !important;
     127        height: <?php echo (int) $main_size; ?>px !important;
    120128}
    121129.fz-fab-buttons.fz-fab-secondary{
    … …  
    123131        border-radius: 100% !important;
    124132        display: block !important;
    125         width: 48px !important;
    126         height: 48px !important;
     133        width: <?php echo (int) $sub_size; ?>px !important;
     134        height: <?php echo (int) $sub_size; ?>px !important;
    127135        margin: auto !important;
    128136        position: relative !important;
    … …  
    136144}
    137145.fz-fab-buttons.fz-fab-secondary img{
    138         width: 48px !important;
    139         height: 48px !important;
     146        width: <?php echo (int) $sub_size; ?>px !important;
     147        height: <?php echo (int) $sub_size; ?>px !important;
    140148        border-radius: 50% !important;
    141149}
    … …  
    192200.fz-fab-box-hide:hover{
    193201        opacity: 1 !important;
     202}
     203@media only screen and (min-width: 320px) and (max-width: 767px){
     204<?php if (!$on_mobile) : ?>
     205        .fz-fab-container,
     206        .fz-fab-box{
     207                display: none !important;
     208        }
     209<?php endif; ?>
     210}
     211@media only screen and (min-width: 768px) and (max-width: 991px){
     212<?php if (!$on_tablet) : ?>
     213        .fz-fab-container,
     214        .fz-fab-box{
     215                display: none !important;
     216        }
     217<?php endif; ?>
     218}
     219@media only screen and (min-width: 992px){
     220<?php if (!$on_desktop) : ?>
     221        .fz-fab-container,
     222        .fz-fab-box{
     223                display: none !important;
     224        }
     225<?php endif; ?>
    194226}
    195227</style>
    … …  
    260292                                <?php
    261293                                $number = preg_replace('/\D+/', '', $content);
    262                                 $whatsapp_url = 'https://wa.me/' . rawurlencode($number) . '?text=' . rawurlencode('Hi');
     294                                $whatsapp_url = 'https://wa.me/' . rawurlencode($number) . '?text=' . rawurlencode($wa_message);
    263295                                ?>
    264296                                <div style="display: block; margin-bottom: 32px; text-align: center; font-size: 16px; font-weight: bold;">
  • floating-action-button/trunk/views/settings.php

    r3823106 r3823148  
    1111$position      = get_option('fz_fab_position', '3');
    1212$type          = get_option('fz_fab_type', '1');
     13$on_mobile     = get_option('fz_fab_display_on_mobile', 'TRUE');
     14$on_tablet     = get_option('fz_fab_display_on_tablet', 'TRUE');
     15$on_desktop    = get_option('fz_fab_display_on_desktop', 'TRUE');
     16$margin        = fz_fab_px(get_option('fz_fab_margin', 15), 15, 0, 400);
     17$main_size     = fz_fab_px(get_option('fz_fab_main_size', 64), 64, 40, 160);
     18$sub_size      = fz_fab_px(get_option('fz_fab_sub_size', 48), 48, 32, 128);
     19$wa_message    = get_option('fz_fab_wa_message', 'Hi');
    1320$main_img_id   = absint(get_option('fz_fab_main_img_id', 0));
    1421$main_color    = fz_fab_hex_or_default(get_option('fz_fab_main_color', FZ_FAB_COLOR), FZ_FAB_COLOR);
    … …  
    7683                                </td>
    7784                        </tr>
     85                        <tr>
     86                                <td class="fz-td-1">
     87                                        <?php esc_html_e('Display on', 'floating-action-button'); ?>
     88                                </td>
     89                                <td>
     90                                        <label style="display: block;">
     91                                                <input id="fz-fab-display-mobile" type="checkbox" value="TRUE" <?php checked((string) $on_mobile, 'TRUE'); ?>>
     92                                                <?php esc_html_e('Phone', 'floating-action-button'); ?>
     93                                        </label>
     94                                        <label style="display: block;">
     95                                                <input id="fz-fab-display-tablet" type="checkbox" value="TRUE" <?php checked((string) $on_tablet, 'TRUE'); ?>>
     96                                                <?php esc_html_e('Tablet', 'floating-action-button'); ?>
     97                                        </label>
     98                                        <label style="display: block;">
     99                                                <input id="fz-fab-display-desktop" type="checkbox" value="TRUE" <?php checked((string) $on_desktop, 'TRUE'); ?>>
     100                                                <?php esc_html_e('Desktop', 'floating-action-button'); ?>
     101                                        </label>
     102                                </td>
     103                        </tr>
     104                        <tr>
     105                                <td class="fz-td-1">
     106                                        <?php esc_html_e('Distance from edge', 'floating-action-button'); ?>
     107                                </td>
     108                                <td>
     109                                        <input id="fz-fab-margin" class="fz-form-element" type="number" min="0" max="400" value="<?php echo esc_attr($margin); ?>">
     110                                        <small class="fz-fab-small"><?php esc_html_e('In pixels', 'floating-action-button'); ?></small>
     111                                </td>
     112                        </tr>
     113                        <tr>
     114                                <td class="fz-td-1">
     115                                        <?php esc_html_e('Main button size', 'floating-action-button'); ?>
     116                                </td>
     117                                <td>
     118                                        <input id="fz-fab-main-size" class="fz-form-element" type="number" min="40" max="160" value="<?php echo esc_attr($main_size); ?>">
     119                                        <small class="fz-fab-small"><?php esc_html_e('In pixels. Default 64.', 'floating-action-button'); ?></small>
     120                                </td>
     121                        </tr>
     122                        <tr>
     123                                <td class="fz-td-1">
     124                                        <?php esc_html_e('Sub button size', 'floating-action-button'); ?>
     125                                </td>
     126                                <td>
     127                                        <input id="fz-fab-sub-size" class="fz-form-element" type="number" min="32" max="128" value="<?php echo esc_attr($sub_size); ?>">
     128                                        <small class="fz-fab-small"><?php esc_html_e('In pixels. Default 48.', 'floating-action-button'); ?></small>
     129                                </td>
     130                        </tr>
     131                        <tr>
     132                                <td class="fz-td-1">
     133                                        <?php esc_html_e('WhatsApp greeting', 'floating-action-button'); ?>
     134                                </td>
     135                                <td>
     136                                        <input id="fz-fab-wa-message" class="fz-form-element" type="text" value="<?php echo esc_attr($wa_message); ?>">
     137                                        <small class="fz-fab-small"><?php esc_html_e('Message that opens in WhatsApp. Leave blank for no message.', 'floating-action-button'); ?></small>
     138                                </td>
     139                        </tr>
    78140                </tbody>
    79141        </table>
Note: See TracChangeset for help on using the changeset viewer.