Plugin Directory

Changeset 3445255


Ignore:
Timestamp:
01/23/2026 02:04:28 AM (2 months ago)
Author:
brainywpbd
Message:

Floating button added

Location:
minifly
Files:
320 added
12 edited

Legend:

Unmodified
Added
Removed
  • minifly/trunk/assets/css/admin-style.css

    r3429932 r3445255  
    570570
    571571/* Click to talk related code goes here */
    572 #sapmfly-click-to-talk-block, #sapmfly-click-to-call-block {
     572#sapmfly-click-to-talk-block,
     573#sapmfly-click-to-call-block,
     574#sapmfly-floating-btn-block {
    573575    display: none;
    574576}
     
    584586
    585587/* Popup Wrapper */
    586 .sapmfly-click-to-talk-area, .sapmfly-click-to-call-area {
     588.sapmfly-click-to-talk-area,
     589.sapmfly-click-to-call-area {
    587590    position: absolute;
    588591    top: 30px;
     
    600603}
    601604
     605/* Popup wrapper for floating button */
     606.sapmfly-floating-btn-area {
     607    position: absolute;
     608    top: 50px;
     609    left: 50%;
     610    transform: translateX(-50%);
     611    width: 360px;
     612    max-height: 90vh;
     613    background: #fff;
     614    border-radius: 8px;
     615    overflow-y: auto;
     616    z-index: 9999;
     617    padding: 18px;
     618    box-shadow: 0 15px 40px rgba(0, 0, 0, .25);
     619    display: none;
     620}
     621
    602622/* Header */
    603623.click-chat-header {
     
    606626}
    607627
    608 .sapmfly-popup-close-btn, .sapmfly-popup-call-close-btn {
     628.sapmfly-popup-close-btn,
     629.sapmfly-popup-call-close-btn,
     630.sapmfly-click-popup-close-icon {
    609631    position: absolute;
    610632    right: 0;
     
    616638
    617639/* Labels */
    618 .sapmfly-click-to-talk-area label, .sapmfly-click-to-call-area label {
     640.sapmfly-click-to-talk-area label,
     641.sapmfly-click-to-call-area label,
     642.sapmfly-floating-btn-group label {
    619643    display: block;
    620644    font-size: 13px;
     
    624648}
    625649
    626 .sapmfly-click-to-talk-area h3, .sapmfly-click-to-call-area h3 {
     650.sapmfly-click-to-talk-area h3,
     651.sapmfly-click-to-call-area h3,
     652.sapmfly-floating-btn-area h3 {
    627653    margin-top: 0;
    628654}
    629655
    630 .click-chat-header-group {
     656.click-chat-header-group,
     657.sapmfly-floating-btn-group {
    631658    display: flex;
    632659    align-items: baseline;
     
    635662}
    636663
    637 .click-chat-image-group {
    638     display: flex;
    639 }
    640 
    641 .click-chat-agent-group {
     664.sapmfly-floating-btn-selected-group {
    642665    display: flex;
    643666    align-items: baseline;
    644667    gap: 10px;
    645     margin-bottom: 5px;
    646 }
    647 
    648 .click-chat-image-group input[type="file"] {
    649     width: 70%;
    650     cursor: pointer;
    651     border: none;
    652     padding-left: 10px;
    653 }
    654 
    655 /* Inputs */
    656 .sapmfly-click-to-talk-area input, .sapmfly-click-to-call-area input {
     668    margin-bottom: 20px;
     669}
     670
     671.sapmfly-floating-btn-selected-group option {
     672    width: 60px;
    657673    height: 30px;
    658674    padding: 0;
     
    665681}
    666682
    667 .sapmfly-click-to-talk-area input:focus {
     683.sapmfly-floating-btn-selected-group select,
     684.sapmfly-floating-btn-selected-group select:focus,
     685.sapmfly-floating-btn-selected-group select:active {
     686    border: none;
     687    outline: none !important;
     688    box-shadow: none !important;
     689    border-bottom: 1px solid #2db742;
     690}
     691
     692.sapmfly-floating-btn-style-group {
     693    display: flex;
     694    gap: 9px;
     695    margin: 10px 0;
     696}
     697
     698
     699
     700.wp-admin .sapmfly-floating-btn-style-group input[type="radio"]:checked::before {
     701    background-color: #46b450 !important;
     702}
     703
     704.click-chat-image-group {
     705    display: flex;
     706    align-items: baseline;
     707    color: #444;
     708}
     709
     710.sapmfly-floating-btn-image-group {
     711    display: flex;
     712    align-items: baseline;
     713    color: #444;
     714    font-weight: 600;
     715    margin-bottom: 10px;
     716}
     717
     718.click-chat-agent-group {
     719    display: flex;
     720    align-items: baseline;
     721    gap: 10px;
     722    margin-bottom: 5px;
     723}
     724
     725.click-chat-image-group input[type="file"],
     726.sapmfly-floating-btn-image-group input[type="file"] {
     727    width: 70%;
     728    cursor: pointer;
     729    border: none;
     730    padding-left: 10px;
     731}
     732
     733/* Inputs */
     734.sapmfly-click-to-talk-area input,
     735.sapmfly-click-to-call-area input,
     736.sapmfly-floating-btn-group input {
     737    height: 30px;
     738    padding: 0;
     739    padding-left: 5px;
     740    border: none;
     741    outline: none;
     742    font-size: 13px;
     743    border-bottom: 1px solid #ddd;
     744    border-radius: 0;
     745}
     746
     747.sapmfly-click-to-talk-area input:focus,
     748.sapmfly-click-to-call-area input:focus,
     749.sapmfly-floating-btn-group input:focus,
     750.sapmfly-floating-btn-group select:focus {
    668751    border-color: #2db742;
    669 }
     752    outline: none;
     753    box-shadow: none;
     754}
     755
    670756
    671757/* Buttons */
     
    676762}
    677763
    678 .sapmfly-click-talk-popup-actions button, .sapmfly-click-call-popup-actions button {
     764.sapmfly-click-talk-popup-actions button,
     765.sapmfly-click-call-popup-actions button {
    679766    padding: 8px 16px;
    680767    margin-right: 5px;
     
    686773}
    687774
    688 .click-chat-save-btn, .click-call-save-btn {
     775.click-chat-save-btn,
     776.click-call-save-btn {
    689777    background-color: #2271b1;
    690778}
     
    694782}
    695783
    696 .click-chat-close-btn, .click-call-close-btn {
     784.click-chat-close-btn,
     785.click-call-close-btn {
     786    background-color: #777777;
     787}
     788
     789.sapmfly-popup-save {
     790    padding: 8px 16px;
     791    margin-right: 5px;
     792    margin-top: 10px;
     793    border: none;
     794    color: #fff;
     795    border-radius: 5px;
     796    cursor: pointer;
     797    background-color: #2271b1;
     798}
     799
     800.sapmfly-popup-clear {
     801    padding: 8px 16px;
     802    margin-right: 5px;
     803    margin-top: 10px;
     804    border: none;
     805    color: #fff;
     806    border-radius: 5px;
     807    cursor: pointer;
     808    background-color: #dd6666;
     809}
     810
     811.sapmfly-popup-close {
     812    padding: 8px 16px;
     813    margin-right: 5px;
     814    margin-top: 10px;
     815    border: none;
     816    color: #fff;
     817    border-radius: 5px;
     818    cursor: pointer;
    697819    background-color: #777777;
    698820}
     
    710832    }
    711833}
    712 
    713 
    714 
    715 
    716 
    717 
    718 
    719 
    720 
    721 
    722 
    723 
    724 
    725 
    726834
    727835.sapmfly-notice {
  • minifly/trunk/assets/css/user-style.css

    r3429932 r3445255  
    277277}
    278278
    279 .sapmfly-click-talk-container .sapmfly-after-click-body, .sapmfly-click-talk-container .sapmfly-after-click-body-call {
     279.sapmfly-click-talk-container .sapmfly-after-click-body,
     280.sapmfly-click-talk-container .sapmfly-after-click-body-call {
    280281    padding: 12px 18px;
    281282    display: flex;
     
    285286}
    286287
    287 .sapmfly-click-talk-container .sapmfly-after-click-body::after, .sapmfly-click-talk-container .sapmfly-after-click-body-call::after {
     288.sapmfly-click-talk-container .sapmfly-after-click-body::after,
     289.sapmfly-click-talk-container .sapmfly-after-click-body-call::after {
    288290    content: "";
    289291    position: absolute;
     
    317319}
    318320
    319 .sapmfly-click-talk-container .sapmfly-after-click-body:hover, .sapmfly-click-talk-container .sapmfly-after-click-body-call:hover {
     321.sapmfly-click-talk-container .sapmfly-after-click-body:hover,
     322.sapmfly-click-talk-container .sapmfly-after-click-body-call:hover {
    320323    background: #f5fcee;
    321324}
     
    362365        transform: translateX(0) translateY(0);
    363366    }
     367
    364368    to {
    365369        transform: translateX(var(--drift, 0px)) translateY(100vh);
    366370    }
    367371}
     372
     373
     374/* Floating button related css goes here */
     375
     376.sapmfly-floating-button {
     377    display: inline-flex;
     378    align-items: center;
     379    justify-content: center;
     380    text-align: center;
     381    position: fixed;
     382    left: var(--sapmfly-floating-btn-left, auto);
     383    right: var(--sapmfly-floating-btn-right, 30px);
     384    top: var(--sapmfly-floating-btn-top, 80%);
     385    bottom: var(--sapmfly-floating-btn-bottom, auto);
     386    background: var(--sapmfly-floating-btn-bg, #fc8443);
     387    color: var(--sapmfly-floating-btn-color, #ffffff);
     388    font-size: 16px;
     389    text-decoration: none;
     390    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
     391    z-index: 9999;
     392    animation: sapmfly-heart-pulse 2.5s ease-in-out infinite;
     393    transition: background 0.25s ease, box-shadow 0.25s ease;
     394}
     395
     396.sapmfly-floating-button-rectangular {
     397    border-radius: 6px;
     398    padding: 10px 15px;
     399    max-width: 200px;
     400}
     401
     402.sapmfly-floating-button-circular {
     403    border-radius: 50%;
     404    aspect-ratio: 1 / 1;
     405    flex-direction: column;
     406    max-width: 120px;
     407}
     408
     409.sapmfly-floating-button:hover {
     410    animation-play-state: paused;
     411    background: var(--sapmfly-floating-btn-hover, #fe7c37);
     412    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
     413}
     414
     415.sapmfly-floating-button-icon {
     416    max-width: 30px;
     417    padding-right: var(--sapmfly-floating-btn-icon-padding-right, 0);
     418    padding-bottom: var(--sapmfly-floating-btn-icon-padding-bottom, 0);
     419}
  • minifly/trunk/assets/js/admin-script.js

    r3429932 r3445255  
    123123
    124124});
     125
     126// Floating button related code goes here
     127function miniflyFloatingBtnPopup() {
     128    document.getElementById('sapmfly-floating-btn-block').style.display = 'block';
     129    document.getElementById('sapmfly-overlay').style.display = 'block';
     130}
     131
     132document.addEventListener('DOMContentLoaded', function () {
     133
     134    var closeBtn = document.querySelector(".sapmfly-click-popup-close-icon");
     135    var closeIcon = document.querySelector(".sapmfly-floating-btn-close");
     136
     137    var popup = document.getElementById("sapmfly-floating-btn-block");
     138    var overlay = document.getElementById("sapmfly-overlay");
     139
     140    function closeCallPopup(e) {
     141        popup.style.display = "none";
     142        overlay.style.display = "none";
     143    }
     144
     145    // Close button
     146    if (closeBtn) {
     147        closeBtn.addEventListener('click', closeCallPopup);
     148    }
     149
     150    // Close icon
     151    if (closeIcon) {
     152        closeIcon.addEventListener('click', closeCallPopup);
     153    }
     154
     155    // Click outside popup
     156    if (overlay) {
     157        overlay.addEventListener('click', closeCallPopup);
     158    }
     159
     160});
     161
     162document.addEventListener('click', function (e) {
     163    if (!e.target.closest('.sapmfly-floating-btn-clear')) return;
     164
     165    const fields = [
     166        'sapmfly_floating_btn_text',
     167        'sapmfly_floating_btn_url',
     168        'sapmfly_floating_btn_color',
     169        'sapmfly_floating_btn_bg',
     170        'sapmfly_floating_btn_hover',
     171        'sapmfly_floating_btn_position'
     172    ];
     173
     174    fields.forEach(id => {
     175        const field = document.getElementById(id);
     176        if (field) field.value = '';
     177    });
     178
     179    // File input clear
     180    const fileInput = document.getElementById('sapmfly_floating_btn_icon');
     181    if (fileInput) fileInput.value = '';
     182
     183    // Radio uncheck
     184    document
     185        .querySelectorAll('input[name="sapmfly_floating_btn_style"]')
     186        .forEach(r => r.checked = false);
     187
     188    // mark image as deleted
     189    window.sapmflyFloatingBtnImageCleared = true;
     190});
     191
    125192
    126193// Call for global toggle all save
     
    669736});
    670737
    671 /* Handle click to call data via AJAX */
     738/* Handle Click Events via AJAX */
    672739document.addEventListener('click', function (e) {
    673     if (e.target.closest('.click-call-save-btn')) {
     740
     741    /* ===============================
     742    CLICK TO CALL SAVE
     743    =============================== */
     744    const clickCallBtn = e.target.closest('.click-call-save-btn');
     745    if (clickCallBtn) {
    674746        e.preventDefault();
    675747
    676         let heading = document
    677             .getElementById('sapmfly_click_call_popup_heading')
    678             ?.value.trim() || '';
    679 
    680         let subheading = document
    681             .getElementById('sapmfly_click_call_popup_subheading')
    682             ?.value.trim() || '';
    683 
    684         // QR Code image
    685         let fileInputQR = document.getElementById('sapmfly_click_call_qr_image');
    686         let fileQR = fileInputQR && fileInputQR.files.length ? fileInputQR.files[0] : null;
    687 
    688         let highlighText = document
    689             .getElementById('sapmfly_click_call_highlight_text')
    690             ?.value.trim() || '';
    691 
    692         let bgColor = document
    693             .getElementById('sapmfly_click_call_color_bg')
    694             ?.value.trim() || '';
    695 
    696         // Agent 1 details
    697         let agentFourName = document
    698             .getElementById('sapmfly_click_talk_agent_4_name')
    699             ?.value.trim() || '';
    700 
    701         let agentFourDesignation = document
    702             .getElementById('sapmfly_click_talk_agent_4_designation')
    703             ?.value.trim() || '';
    704 
    705         let agentFourNumber = document
    706             .getElementById('sapmfly_click_talk_agent_4_number')
    707             ?.value.trim() || '';
    708 
    709         let agentFourImage = document.getElementById('sapmfly_click_talk_agent_4_image');
    710         let fileAgentFourImage = agentFourImage && agentFourImage.files.length ? agentFourImage.files[0] : null;
    711 
    712         // FormData use handler
    713         let formData = new FormData();
     748        const formData = new FormData();
    714749        formData.append('action', 'sapmfly_save_click_call_heading');
    715750        formData.append('_wpnonce', sapmfly_click_call_ajax.nonce);
    716         formData.append('sapmfly_click_call_popup_heading', heading);
    717         formData.append('sapmfly_click_call_popup_subheading', subheading);
    718         formData.append('sapmfly_click_call_highlight_text', highlighText);
    719         formData.append('sapmfly_click_call_color_bg', bgColor);
    720 
    721         // QR Code image
    722         if (fileQR) {
    723             formData.append('sapmfly_click_call_qr_image', fileQR);
    724         }
    725 
    726         // Agent 1
    727         formData.append('sapmfly_click_talk_agent_4_name', agentFourName);
    728         formData.append('sapmfly_click_talk_agent_4_designation', agentFourDesignation);
    729         formData.append('sapmfly_click_talk_agent_4_number', agentFourNumber);
    730         if (fileAgentFourImage) {
    731             formData.append('sapmfly_click_talk_agent_4_image', fileAgentFourImage);
     751
     752        formData.append(
     753            'sapmfly_click_call_popup_heading',
     754            document.getElementById('sapmfly_click_call_popup_heading')?.value.trim() || ''
     755        );
     756
     757        formData.append(
     758            'sapmfly_click_call_popup_subheading',
     759            document.getElementById('sapmfly_click_call_popup_subheading')?.value.trim() || ''
     760        );
     761
     762        formData.append(
     763            'sapmfly_click_call_highlight_text',
     764            document.getElementById('sapmfly_click_call_highlight_text')?.value.trim() || ''
     765        );
     766
     767        formData.append(
     768            'sapmfly_click_call_color_bg',
     769            document.getElementById('sapmfly_click_call_color_bg')?.value.trim() || ''
     770        );
     771
     772        // QR Image
     773        const qrInput = document.getElementById('sapmfly_click_call_qr_image');
     774        if (qrInput && qrInput.files.length) {
     775            formData.append('sapmfly_click_call_qr_image', qrInput.files[0]);
     776        }
     777
     778        // Agent 4
     779        formData.append(
     780            'sapmfly_click_talk_agent_4_name',
     781            document.getElementById('sapmfly_click_talk_agent_4_name')?.value.trim() || ''
     782        );
     783
     784        formData.append(
     785            'sapmfly_click_talk_agent_4_designation',
     786            document.getElementById('sapmfly_click_talk_agent_4_designation')?.value.trim() || ''
     787        );
     788
     789        formData.append(
     790            'sapmfly_click_talk_agent_4_number',
     791            document.getElementById('sapmfly_click_talk_agent_4_number')?.value.trim() || ''
     792        );
     793
     794        const agentImg = document.getElementById('sapmfly_click_talk_agent_4_image');
     795        if (agentImg && agentImg.files.length) {
     796            formData.append('sapmfly_click_talk_agent_4_image', agentImg.files[0]);
    732797        }
    733798
     
    737802        })
    738803            .then(res => res.json())
    739             .then(data => {
    740                 const popup = document.getElementById('sapmfly-click-to-call-block');
    741                 const overlay = document.getElementById('sapmfly-overlay');
    742 
    743                 if (data.success) {
    744                     sapmflyShowNotice(
    745                         'sapmfly-admin-notice-call',
    746                         data.data,
    747                         'success',
    748                         function () {
    749                             if (popup) popup.style.display = 'none';
    750                             if (overlay) overlay.style.display = 'none';
    751                         }
    752                     );
    753                 } else {
    754                     sapmflyShowNotice(
    755                         'sapmfly-admin-notice-call',
    756                         'Error: ' + data.data,
    757                         'error'
    758                     );
    759                 }
    760             });
    761     }
    762 });
     804            .then(data => handleResponse(
     805                data,
     806                'sapmfly-click-to-call-block'
     807            ))
     808            .catch(err => showAjaxError(err));
     809
     810        return; // stop further checks
     811    }
     812
     813    /* ===============================
     814    FLOATING BUTTON SAVE
     815    =============================== */
     816    const floatingBtn = e.target.closest('.sapmfly-floating-btn-save');
     817    if (floatingBtn) {
     818        e.preventDefault();
     819
     820        const floatingBtnFormData = new FormData();
     821        floatingBtnFormData.append('action', 'sapmfly_floating_btn_handling');
     822        floatingBtnFormData.append('_wpnonce', sapmfly_floating_btn_ajax.nonce);
     823
     824        floatingBtnFormData.append(
     825            'sapmfly_floating_btn_text',
     826            document.getElementById('sapmfly_floating_btn_text')?.value.trim() || ''
     827        );
     828
     829        floatingBtnFormData.append(
     830            'sapmfly_floating_btn_url',
     831            document.getElementById('sapmfly_floating_btn_url')?.value.trim() || ''
     832        );
     833
     834        floatingBtnFormData.append(
     835            'sapmfly_floating_btn_color',
     836            document.getElementById('sapmfly_floating_btn_color')?.value.trim() || ''
     837        );
     838
     839        floatingBtnFormData.append(
     840            'sapmfly_floating_btn_bg',
     841            document.getElementById('sapmfly_floating_btn_bg')?.value.trim() || ''
     842        );
     843
     844        floatingBtnFormData.append(
     845            'sapmfly_floating_btn_hover',
     846            document.getElementById('sapmfly_floating_btn_hover')?.value.trim() || ''
     847        );
     848
     849        if (window.sapmflyFloatingBtnImageCleared) {
     850            floatingBtnFormData.append('sapmfly_floating_btn_icon_delete', '1');
     851        }
     852
     853        const floatingBtnIcon = document.getElementById('sapmfly_floating_btn_icon');
     854        if (floatingBtnIcon && floatingBtnIcon.files.length) {
     855            floatingBtnFormData.append('sapmfly_floating_btn_icon', floatingBtnIcon.files[0]);
     856        }
     857
     858        const styleEl = document.querySelector(
     859            'input[name="sapmfly_floating_btn_style"]:checked'
     860        );
     861
     862        floatingBtnFormData.append(
     863            'sapmfly_floating_btn_style',
     864            styleEl ? styleEl.value : ''
     865        );
     866
     867        floatingBtnFormData.append(
     868            'sapmfly_floating_btn_position',
     869            document.getElementById('sapmfly_floating_btn_position')?.value.trim() || ''
     870        );
     871
     872        fetch(ajaxurl, {
     873            method: 'POST',
     874            body: floatingBtnFormData
     875        })
     876            .then(res => res.json())
     877            .then(data => handleResponse(
     878                data,
     879                'sapmfly-floating-btn-block',
     880                'sapmfly-admin-notice-floating'
     881            ))
     882            .catch(err => showAjaxError(err));
     883    }
     884});
     885
     886/* ===============================
     887COMMON HELPERS
     888=============================== */
     889function handleResponse(data, popupId, noticeId = 'sapmfly-admin-notice-call') {
     890    const popup = document.getElementById(popupId);
     891    const overlay = document.getElementById('sapmfly-overlay');
     892
     893    if (data.success) {
     894        sapmflyShowNotice(
     895            noticeId,
     896            data.data || 'Saved successfully',
     897            'success',
     898            function () {
     899                if (popup) popup.style.display = 'none';
     900                if (overlay) overlay.style.display = 'none';
     901            }
     902        );
     903    } else {
     904        sapmflyShowNotice(
     905            noticeId,
     906            data.data || 'Something went wrong',
     907            'error'
     908        );
     909    }
     910}
     911
     912function showAjaxError(error, noticeId = 'sapmfly-admin-notice-call') {
     913    sapmflyShowNotice(
     914        noticeId,
     915        'AJAX Error: ' + error.message,
     916        'error'
     917    );
     918}
  • minifly/trunk/minifly.php

    r3429932 r3445255  
    55 * Plugin URI:        https://brainywp.com/minifly/
    66 * Description:       Minifly is your favorite, lightweight companion for better performance. Supercharge your site with tiny tools that make a big difference.
    7  * Version:           1.0.32
     7 * Version:           1.2.01
    88 * Requires at least: 5.2
    99 * Requires PHP:      7.2
  • minifly/trunk/readme.txt

    r3429932 r3445255  
    44Requires at least: 5.2
    55Tested up to: 6.9
    6 Stable tag: 1.0.32
     6Stable tag: 1.2.01
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    5454* **Click to chat and call** - Calling via call is all time popular support method. We have added click to call widget at Minifly that also work like **Call Now Button** in your WP Site. Once you configure [**Click to Call**](https://brainywp.com/blog/ai-article-summarizer-to-a-wordpress-blog-site/) options, users from mobile phone in your site call call with single tap.
    5555* **Christmas Snow Effects** - Christmas decorations is now one click matter. Display **snow fall animation** on the front of your website for a festive presentation. Bring Christmas mood and falling snowflakes with unique and realistic animation.
     56* **Floating Sticky Button** - Sticky Button lets you add stylish floating action buttons to your website. It remain fixed on the screen during scrolling, making it easy for visitors to access key actions. You can easily promote special deal, dedicated page or an offer via **Minifly Floating Sticky Button**.
    5657
    5758## WordPress white label solution features at Minifly
     
    103104
    104105== Changelog ==
     106
     107= 1.2.01 (22 January 2026) =
     108First update in 2026
     109New: Floating button to promote special link/page
    105110
    106111= 1.0.32 (31 December 2025) =
  • minifly/trunk/templates/admin/all-admin-hooks.php

    r3390774 r3445255  
    110110
    111111// Block all external REST API requests if toggle is enabled
    112 function sapmfly_block_external_rest_api_requests($access) {
     112function sapmfly_block_external_rest_api_requests($access)
     113{
    113114    $disable_restapi = get_option('sapmfly_disable_call_restapi');
    114115
     
    462463
    463464// Limit revision number for post and page
    464 add_action('admin_init', function() {
     465add_action('admin_init', function () {
    465466    $limit_revision_number = get_option('sapmfly_limit_revision_number', 'no');
    466    
     467
    467468    if ($limit_revision_number === 'yes') {
    468469        $post_types = array('post', 'page');
     
    495496    }
    496497});
    497 
    498 // Elementor custom css related code goes here
  • minifly/trunk/templates/admin/features/disable-plugin-update.php

    r3372734 r3445255  
    2525        </div>
    2626        <div class="sapmfly-tags">
    27             <p><?php echo esc_html__('New', 'minifly'); ?></p>
     27            <p><?php echo esc_html__('New Feature', 'minifly'); ?></p>
    2828        </div>
    2929
  • minifly/trunk/templates/admin/features/external-link.php

    r3369066 r3445255  
    2525        </div>
    2626        <div class="sapmfly-tags">
    27             <p><?php echo esc_html__('New', 'minifly'); ?></p>
     27            <p><?php echo esc_html__('New Feature', 'minifly'); ?></p>
    2828        </div>
    2929
  • minifly/trunk/templates/admin/features/limited-revision-number.php

    r3375411 r3445255  
    3232        </div>
    3333        <div class="sapmfly-tags">
    34             <p><?php echo esc_html__('New', 'minifly'); ?></p>
     34            <p><?php echo esc_html__('New Feature', 'minifly'); ?></p>
    3535        </div>
    3636
  • minifly/trunk/templates/extra-hooks.php

    r3429932 r3445255  
    234234    wp_send_json_success('Popup settings saved successfully');
    235235});
     236
     237
     238// Handle Click to call AJAX saving
     239add_action('wp_ajax_sapmfly_floating_btn_handling', function () {
     240
     241    // Nonce check
     242    if (
     243        !isset($_POST['_wpnonce']) ||
     244        !wp_verify_nonce($_POST['_wpnonce'], 'sapmfly_floating_btn_popup_ajax')
     245    ) {
     246        wp_send_json_error('Invalid nonce');
     247    }
     248
     249    // Input receive sanitize
     250    $btnText = sanitize_text_field($_POST['sapmfly_floating_btn_text'] ?? '');
     251
     252    $raw_url = $_POST['sapmfly_floating_btn_url'] ?? '';
     253
     254    if ($raw_url === '' || $raw_url === '#') {
     255        $btnUrl = $raw_url;
     256    } else {
     257        $btnUrl = esc_url_raw($raw_url);
     258        if (empty($btnUrl)) {
     259            wp_send_json_error('Invalid URL provided');
     260        }
     261    }
     262
     263    $btnColor = sanitize_text_field($_POST['sapmfly_floating_btn_color'] ?? '');
     264    $btnBg = sanitize_text_field($_POST['sapmfly_floating_btn_bg'] ?? '');
     265    $btnHover = sanitize_text_field($_POST['sapmfly_floating_btn_hover'] ?? '');
     266    $btnIcon = sanitize_text_field($_POST['sapmfly_floating_btn_icon'] ?? '');
     267    $btnStyle = sanitize_text_field($_POST['sapmfly_floating_btn_style'] ?? '');
     268    $btnPosition = sanitize_text_field($_POST['sapmfly_floating_btn_position'] ?? '');
     269
     270    // Save text fields
     271    update_option('sapmfly_floating_btn_text', $btnText);
     272    update_option('sapmfly_floating_btn_url', $btnUrl);
     273    update_option('sapmfly_floating_btn_color', $btnColor);
     274    update_option('sapmfly_floating_btn_bg', $btnBg);
     275    update_option('sapmfly_floating_btn_hover', $btnHover);
     276
     277    // If delete requested
     278    if (!empty($_POST['sapmfly_floating_btn_icon_delete'])) {
     279        delete_option('sapmfly_floating_btn_icon');
     280    }
     281
     282    // If new image uploaded → override delete
     283    if (!empty($_FILES['sapmfly_floating_btn_icon'])) {
     284        sapmfly_handle_image_upload(
     285            'sapmfly_floating_btn_icon',
     286            'sapmfly_floating_btn_icon'
     287        );
     288    }
     289
     290    update_option('sapmfly_floating_btn_style', $btnStyle);
     291    update_option('sapmfly_floating_btn_position', $btnPosition);
     292
     293    // Send success response
     294    wp_send_json_success('Popup settings saved successfully');
     295});
  • minifly/trunk/templates/user/all-hooks.php

    r3429932 r3445255  
    382382{
    383383?>
    384 <script>
    385 document.addEventListener('DOMContentLoaded', function () {
    386     const blocks = document.querySelectorAll('.sapmfly-after-click-body-call');
    387 
    388     function isMobileDevice() {
    389         return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent);
    390     }
    391 
    392     blocks.forEach(function (block) {
    393         block.addEventListener('click', function () {
    394             const phone = this.dataset.phone;
    395 
    396             if (!phone) {
    397                 alert('Sorry, this agent is currently unavailable.');
    398                 return;
     384    <script>
     385        document.addEventListener('DOMContentLoaded', function() {
     386            const blocks = document.querySelectorAll('.sapmfly-after-click-body-call');
     387
     388            function isMobileDevice() {
     389                return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent);
    399390            }
    400391
    401             if (isMobileDevice()) {
    402                 // Mobile normal call behavior
    403                 window.location.href = 'tel:' + phone;
    404             } else {
    405                 // Desktop clear feedback
    406                 alert(
    407                     'No calling app found! Please use your mobile phone or a device with a calling app installed.'
    408                 );
    409             }
     392            blocks.forEach(function(block) {
     393                block.addEventListener('click', function() {
     394                    const phone = this.dataset.phone;
     395
     396                    if (!phone) {
     397                        alert('Sorry, this agent is currently unavailable.');
     398                        return;
     399                    }
     400
     401                    if (isMobileDevice()) {
     402                        // Mobile normal call behavior
     403                        window.location.href = 'tel:' + phone;
     404                    } else {
     405                        // Desktop clear feedback
     406                        alert(
     407                            'No calling app found! Please use your mobile phone or a device with a calling app installed.'
     408                        );
     409                    }
     410                });
     411            });
    410412        });
    411     });
    412 });
    413 </script>
     413    </script>
    414414<?php
    415415}
     
    421421    $bgColor = get_option('sapmfly_click_talk_color_bg');
    422422
     423    // Floating button related code
     424    $floatingBtnColor = get_option('sapmfly_floating_btn_color');
     425    $floatingBtnBg = get_option('sapmfly_floating_btn_bg');
     426    $floatingBtnHover = get_option('sapmfly_floating_btn_hover');
     427    if ($floatingBtnColor == '#000000' && $floatingBtnBg == '#000000' && $floatingBtnHover == '#000000') {
     428        $floatingBtnColor = '#ffffff';
     429        $floatingBtnBg = '#FC8443';
     430        $floatingBtnHover = '#ff7830';
     431    }
     432
     433    $floatingBtnPosition = get_option('sapmfly_floating_btn_position');
     434    $sapmflyFloatingBtnStyle = get_option('sapmfly_floating_btn_style');
     435
    423436    if (empty($bgColor)) {
    424437        $bgColor = '#2eb843';
    425438    }
    426439
    427     echo '<style>:root { --sapmfly-click-talk-bg-color: ' . esc_attr($bgColor) . '; }</style>';
     440    $floatingBtnIconPaddingRight = '';
     441    $floatingBtnIconPaddingBottom = '';
     442
     443    if ($sapmflyFloatingBtnStyle == 'rectangular') {
     444        $floatingBtnIconPaddingRight = '10px';
     445        $floatingBtnIconPaddingBottom = '0';
     446    } elseif ($sapmflyFloatingBtnStyle == 'circular') {
     447        $floatingBtnIconPaddingRight = '0';
     448        $floatingBtnIconPaddingBottom = '10px';
     449    } else {
     450        $floatingBtnIconPaddingRight = '10px';
     451        $floatingBtnIconPaddingBottom = '0';
     452    }
     453
     454    $floatingBtnPosition_css_left   = '';
     455    $floatingBtnPosition_css_right  = '';
     456    $floatingBtnPosition_css_top    = '';
     457    $floatingBtnPosition_css_bottom = '';
     458
     459    switch ($floatingBtnPosition) {
     460
     461        case 'top-left':
     462            $floatingBtnPosition_css_left = '30px';
     463            $floatingBtnPosition_css_right = 'auto';
     464            $floatingBtnPosition_css_top = '10%';
     465            $floatingBtnPosition_css_bottom = 'auto';
     466            break;
     467
     468        case 'top-right':
     469            $floatingBtnPosition_css_left = 'auto';
     470            $floatingBtnPosition_css_right = '30px';
     471            $floatingBtnPosition_css_top = '10%';
     472            $floatingBtnPosition_css_bottom = 'auto';
     473            break;
     474
     475        case 'center-left':
     476            $floatingBtnPosition_css_left = '30px';
     477            $floatingBtnPosition_css_right = 'auto';
     478            $floatingBtnPosition_css_top = '50%';
     479            $floatingBtnPosition_css_bottom = 'auto';
     480            break;
     481
     482        case 'center-right':
     483            $floatingBtnPosition_css_left = 'auto';
     484            $floatingBtnPosition_css_right = '30px';
     485            $floatingBtnPosition_css_top = '50%';
     486            $floatingBtnPosition_css_bottom = 'auto';
     487            break;
     488
     489        case 'bottom-left':
     490            $floatingBtnPosition_css_left = '30px';
     491            $floatingBtnPosition_css_right = 'auto';
     492            $floatingBtnPosition_css_top = '80%';
     493            $floatingBtnPosition_css_bottom = 'auto';
     494            break;
     495
     496        case 'bottom-right':
     497            $floatingBtnPosition_css_left = 'auto';
     498            $floatingBtnPosition_css_right = '30px';
     499            $floatingBtnPosition_css_top = '80%';
     500            $floatingBtnPosition_css_bottom = 'auto';
     501            break;
     502
     503        default:
     504            $floatingBtnPosition_css_left = 'auto';
     505            $floatingBtnPosition_css_right = '30px';
     506            $floatingBtnPosition_css_top = '80%';
     507            $floatingBtnPosition_css_bottom = 'auto';
     508            break;
     509    }
     510
     511    echo '<style>
     512        :root {
     513        --sapmfly-click-talk-bg-color: ' . esc_attr($bgColor) . ';
     514        --sapmfly-floating-btn-color: ' . esc_attr($floatingBtnColor) . ';
     515        --sapmfly-floating-btn-bg: ' . esc_attr($floatingBtnBg) . ';
     516        --sapmfly-floating-btn-hover: ' . esc_attr($floatingBtnHover) . ';
     517        --sapmfly-floating-btn-left: ' . esc_attr($floatingBtnPosition_css_left) . ';
     518        --sapmfly-floating-btn-right: ' . esc_attr($floatingBtnPosition_css_right) . ';
     519        --sapmfly-floating-btn-top: ' . esc_attr($floatingBtnPosition_css_top) . ';
     520        --sapmfly-floating-btn-bottom: ' . esc_attr($floatingBtnPosition_css_bottom) . ';
     521        --sapmfly-floating-btn-icon-padding-right: ' . esc_attr($floatingBtnIconPaddingRight) . ';
     522        --sapmfly-floating-btn-icon-padding-bottom: ' . esc_attr($floatingBtnIconPaddingBottom) . ';
     523        }
     524    </style>';
    428525});
    429526
     
    477574<?php
    478575}
     576
     577$sapmfly_floating_btn_front = SAPMFLY_TEMPLATES . 'user/features/floating-btn-front.php';
     578if (file_exists($sapmfly_floating_btn_front)) {
     579    require_once $sapmfly_floating_btn_front;
     580}
  • minifly/trunk/templates/user/user-setup.php

    r3429932 r3445255  
    5555            update_option('sapmfly_christmas_snowfall', $christmas_snowfall);
    5656
     57            $add_sitewide_floating_button = isset($_POST['sapmfly_sitewide_floating_button']) ? 'yes' : 'no';
     58            update_option('sapmfly_sitewide_floating_button', $add_sitewide_floating_button);
     59
    5760            $global_toggle_value = isset($_POST['sapmfly_widgets_toggle']) ? 'yes' : 'no';
    5861            update_option('sapmfly_widgets_toggle', $global_toggle_value);
     
    7477    $click_to_call = get_option('sapmfly_click_to_call', 'no');
    7578    $christmas_snowfall = get_option('sapmfly_christmas_snowfall', 'no');
     79    $add_sitewide_floating_button = get_option('sapmfly_sitewide_floating_button', 'no');
    7680
    7781    // Save global save option
     
    217221                                    ?>
    218222
     223                                    <!-- Enable user switch -->
     224                                    <?php
     225                                    $sapmfly_sitewide_floating_btn = SAPMFLY_TEMPLATES . 'user/features/sitewide-floating-button.php';
     226                                    if (file_exists($sapmfly_sitewide_floating_btn)) {
     227                                        require_once $sapmfly_sitewide_floating_btn;
     228                                    }
     229                                    ?>
     230
    219231                                </div>
    220232                                <br><br>
Note: See TracChangeset for help on using the changeset viewer.