HEX
Server: Apache
System: Linux 162-240-236-42.bluehost.com 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
User: bt667 (1004)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/bt667/public_html/wp-content/plugins/old24-flying-pages/inject-js.php
<?php

// Embed the scripts we need for this plugin
function flying_pages_enqueue_scripts() {
    
    // Disable for logged admins
    if(get_option('flying_pages_config_disable_on_login') && current_user_can( 'manage_options' )) return;

    // Abort if the response is AMP since custom JavaScript isn't allowed
    if (function_exists('is_amp_endpoint') && is_amp_endpoint()) return;

    wp_enqueue_script('flying-pages', plugin_dir_url(__FILE__) . 'flying-pages.min.js', array(), FLYING_PAGES_VERSION, true);
    wp_add_inline_script(
        'flying-pages',
'window.FPConfig= {
	delay: '.esc_html(get_option('flying_pages_config_delay')).',
	ignoreKeywords: '.json_encode(get_option('flying_pages_config_ignore_keywords'), true).',
	maxRPS: '.esc_html(get_option('flying_pages_config_max_rps')).',
    hoverDelay: '.esc_html(get_option('flying_pages_config_hover_delay')).'
};',
        "before"
    );
}
add_action('wp_enqueue_scripts', 'flying_pages_enqueue_scripts');

// Add defer attribute to Flying Pages script tag
function flying_pages_add_defer($tag, $handle) {
    if ('flying-pages' === $handle && false === strpos($tag, 'defer')) {
        $tag = preg_replace(':(?=></script>):', ' defer', $tag);
    }
    return $tag;
}
add_filter('script_loader_tag', 'flying_pages_add_defer', 10, 2);