HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/video-rental/wp-content/themes/video-rental-old/footer.php
<!-- Logout Modal -->
<div class="modal fade logout-modal custom-modal" id="logoutModal" tabindex="-1" aria-labelledby="logoutModalLabel"
    aria-hidden="true">
    <div class="modal-dialog modal-md modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header border-0">
                <button type="button" class="close-btn" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>

            <!-- Hidden real logout link with secure nonce -->
            <a id="trueLogout" href="<?php echo wp_logout_url(add_query_arg('logged_out', 'true', home_url('/'))); ?>"
                style="display:none;"></a>

            <div class="modal-body">
                <div class="logout-modal-block">
                    <div class="img-block text-center">
                        <img src="<?php echo get_template_directory_uri(); ?>/img/logout-img.svg" alt="">
                    </div>
                    <div class="txt-block text-center">
                        <h3>You’re <span>Logged Out</span></h3>
                        <p>For your security, we’ve ended your session.</p>
                    </div>
                </div>

                <div class="modal-footer d-flex justify-content-between">
                    <button class="btn back-btn verify-btn">Back to Home</button>
                    <button class="btn verify-btn" id="loggedOut-btn">Submit</button>
                </div>
            </div>
        </div>
    </div>
</div>
<footer class="site-footer">
    <div class="container custom-container">
        <div class="row ft-inner">
            <div class="lef-sec">
                <div class="logo-footer"><img src="<?php echo get_template_directory_uri(); ?>/img/footer-logo.svg"
                        alt="footer-logo"></div>
                <div class="footer-description">
                    <div>Tisha B'Av:</div>
                    <div>Stories That Inspire, Messages That Matter</div>
                </div>
            </div>
            <div class="footer-rt">
                <ul class="footer-nav">
                    <li><a href="<?= home_url() ?>"
                            class="footer-link <?php echo (is_front_page()) ? 'active' : ''; ?>">Home</a></li>
                    <li><a href="<?= site_url('about-us') ?>"
                            class="footer-link <?php echo is_page('about-us') ? 'active' : ''; ?>">About</a></li>
                    <li><a href="<?= site_url('contact-us') ?>"
                            class="footer-link <?php echo is_page('contact-us') ? 'active' : ''; ?>">Contact Us</a></li>
                    <!-- <li><a href="#" class="footer-link">Help</a></li> -->
                </ul>

            </div>



        </div>
    </div>
</footer>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<!-- scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js"
    integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg=="
    crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/parsleyjs@2.9.2/dist/parsley.min.js"></script>

<script>
    $(document).ready(function () {
        $('.banner-slider').slick({
            slidesToShow: 1,
            slidesToScroll: 1,
            arrows: false,
            dots: false,
            autoplay: false,
        });
    });

    $('a[href^="#"]').click(function (e) {
        e.preventDefault(); // Prevent the default anchor click behavior
        var target = $($(this).attr('href')); // Get the target element from the href attribute
        if (target.length) { // Check if the target element exists
            $('html, body').animate({
                scrollTop: target.offset().top // Animate scrolling to the target position
            }, 100); // Adjust the scroll speed (500 milliseconds)
        }
    });


    // Menu
    $('[data-toggle="offcanvas"]').on('click', function () {
        $('.offcanvas-collapse').toggleClass('open');
        $('body').toggleClass('nav-active');
    })


    $(window).scroll(function () {
        if ($(this).scrollTop() > 80) {
            $('.header').addClass('shrink');
        } else {
            $('.header').removeClass('shrink');
        }
    });
    $(document).ready(function () {
        $(".hamburger").click(function () {
            $(this).toggleClass("is-active");
        });
    });

    $('.navbar-nav .nav-item a').click(function (e) {
        // Check if the clicked link has the 'dropdown-toggle' class
        if (!$(this).hasClass('dropdown-toggle')) {
            $('.navbar-collapse').removeClass('open');
            $('.hamburger').removeClass('is-active');
        }

        $('.navbar-nav .nav-item a').removeClass('active');
        $(this).addClass('active');

        // Smooth scrolling
        $('html, body').animate({
            scrollTop: $($(this).attr('href')).offset().top - 60
        }, 100);
    });


    //         $(".user-wrap .link").click(function(){ alert('sd')
    //   $(".user-list").toggleClass("main");
    // });


    $(document).ready(function () {
        $("#userClick").click(function () {
            $('.user-list').slideToggle();
        });
    });


</script>

<script>
    jQuery(document).ready(function ($) {
        $('.send-affiliate-link').on('click', function () {
            const userId = $(this).data('user-id');
            const button = $(this);
            button.prop('disabled', true).text('Sending...');

            $.post(sendAffiliateAjax.ajax_url, {
                action: 'send_affiliate_email',
                user_id: userId,
                nonce: sendAffiliateAjax.nonce
            }, function (response) {
                if (response.success) {
                    alert('Affiliate link sent!');
                } else {
                    alert('Error: ' + (response.data.message || 'Something went wrong.'));
                }
                button.prop('disabled', false).text('Send');
            });
        });
    });
    document.addEventListener('DOMContentLoaded', function () {
        // Get affiliate code from cookie or URL
        function getAffiliateCode() {
            // Check cookie
            const cookieMatch = document.cookie.match(/(?:^|; )affiliate_ref=([^;]+)/);
            if (cookieMatch) {
                return decodeURIComponent(cookieMatch[1]);
            }

            // Check URL (fallback)
            const urlParams = new URLSearchParams(window.location.search);
            return urlParams.get('aff') || '';
        }

        const affCode = getAffiliateCode();
        if (affCode) {
            const affInput = document.getElementById('affiliateCode');
            if (affInput) affInput.value = affCode;
        }
    });

    document.addEventListener('DOMContentLoaded', function () {
        const radios = document.querySelectorAll('input[name="package_types"]');
        const amountDisplay = document.getElementById('amountDisplay');
        const amountInput = document.getElementById('amount');

        function updateAmount(packageType) {
            fetch('<?php echo admin_url('admin-ajax.php'); ?>?action=get_package_price&type=' + packageType)
                .then(response => response.json())
                .then(data => {
                    if (data.success) {
                        const price = parseFloat(data.data.amount).toFixed(2);
                        amountDisplay.textContent = `$${price}`;
                        amountInput.value = price;
                    } else {
                        alert('Error fetching price: ' + data.data.message);
                    }
                })
                .catch(error => {
                    console.error('AJAX error:', error);
                    alert('Something went wrong.');
                });
        }

        // On radio change
        radios.forEach(function (radio) {
            radio.addEventListener('change', function () {
                updateAmount(this.value);
            });
        });

        // Trigger default on page load (assuming "single" is checked by default)
        const defaultChecked = document.querySelector('input[name="package_types"]:checked');
        if (defaultChecked) {
            updateAmount(defaultChecked.value);
        }
    });

    jQuery(document).ready(function ($) {
        $('#step1Form').parsley();
    });

    document.addEventListener('DOMContentLoaded', function () {
        const expiryInput = document.getElementById('expiry');

        if (expiryInput) {
            expiryInput.addEventListener('input', function () {
                let val = expiryInput.value.replace(/\D/g, ''); // Remove non-digits

                if (val.length >= 2) {
                    val = val.substring(0, 2) + '/' + val.substring(2, 4);
                }

                expiryInput.value = val.substring(0, 5); // Enforce MM/YY format
            });
        } else {
            console.warn("Element with ID 'expiry' not found.");
        }
    });


    const states = [
        "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
        "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
        "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
        "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
        "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota",
        "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina",
        "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington",
        "West Virginia", "Wisconsin", "Wyoming"
    ];

    const select = document.getElementById('stateSelect');

    // states.forEach(state => {
    //     const option = document.createElement('option');
    //     option.value = state;
    //     option.textContent = state;
    //     select.appendChild(option);
    // });
    if (select) {
        states.forEach(state => {
            const option = document.createElement('option');
            option.value = state;
            option.textContent = state;
            select.appendChild(option);
        });
    } else {
        console.warn('Select element not found!');
    }

    if (window.location.search.includes('aff=')) {
        setTimeout(() => {
            const url = new URL(window.location.href);
            url.searchParams.delete('aff');
            window.history.replaceState({}, document.title, url.pathname + url.search);
        }, 2000); // wait 2 seconds before removing from URL
    }
    document.addEventListener('DOMContentLoaded', function () {
        const modal = new bootstrap.Modal(document.getElementById('videoPlayerModal'));
        const iframe = document.getElementById('videoIframe');

        document.querySelectorAll('.play-video').forEach(el => {
            el.addEventListener('click', function (e) {
                e.preventDefault();
                const videoUrl = this.getAttribute('data-video-url');
                if (videoUrl) {
                    iframe.src = videoUrl + '?autoplay=1';
                    modal.show();
                }
            });
        });

        // Stop video on modal close
        document.getElementById('videoPlayerModal').addEventListener('hidden.bs.modal', () => {
            iframe.src = '';
        });
    });


    jQuery(document).ready(function ($) {
        const isUserLoggedIn = <?php echo is_user_logged_in() ? 'true' : 'false'; ?>;

        $('.rent-now-btn').on('click', function () {
            const postId = $(this).data('post-id');

            if (isUserLoggedIn) {
                const modal = new bootstrap.Modal(document.getElementById('modalStep1'));
                modal.show();
                const selectedInput = $('input[name="radio-group"]:checked').attr('id');
                const selectedPackage = selectedInput === 'packageone' ? 'single' : 'family';

                // const selectedPrice = prices[selectedPackage];

                // $('input[name="package_types"][value="' + selectedPackage + '"]').prop('checked', true);
                // $('#amountDisplay').text(`$${selectedPrice.toFixed(2)}`);
                // $('#amount').val(selectedPrice);

                // Pass video ID
                const videoId = $(this).data('post-id');
                $('#rentalVideoId').val(videoId);
            } else {
                const loginPrompt = new bootstrap.Modal(document.getElementById('loginPromptModal'));
                loginPrompt.show();

                $('.proceed-login').off('click').on('click', function () {
                    // Redirect with post ID and continue flag
                    window.location.href = `/login/?continue_rent=1&post_id=${postId}`;
                });
            }
        });

        // After login, if ?continue_rent=1 is present, show rent modal
        const urlParams = new URLSearchParams(window.location.search);
        if (isUserLoggedIn && urlParams.get('continue_rent') === '1') {
            const modal = new bootstrap.Modal(document.getElementById('modalStep1'));
            modal.show();

            // Optionally clear query params after showing modal
            const newUrl = window.location.origin + window.location.pathname;
            window.history.replaceState({}, document.title, newUrl);
        }
    });



</script>

<?php wp_footer(); ?>
</body>

</html>