# searchpro/1.9.3/inc/dropin-functions.php

BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS &amp; JavaScript, version 1.9.3. 52 lines.

- Page: https://pluginprobe.com/plugins/searchpro/1.9.3/code/inc/dropin-functions.php
- Raw: https://pluginprobe.com/plugins/searchpro/1.9.3/raw/inc/dropin-functions.php
- Modified: 2024-08-20T18:04:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/searchpro/1.9.3/code/inc/dropin-functions.php#L10-L20`.

```php
<?php

function bwp_is_ajax() {
    return 
        (function_exists("wp_doing_ajax") && wp_doing_ajax()) ||
        (defined('DOING_AJAX') && DOING_AJAX) ||
        (!empty($_SERVER["HTTP_X_REQUESTED_WITH"]) && $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest") ||
        (!empty($_SERVER["REQUEST_URI"]) && basename($_SERVER["REQUEST_URI"]) == "admin-ajax.php") ||
        !empty($_GET["wc-ajax"]);
}

function bwp_is_user_logged_in() {
    foreach ($_COOKIE as $key => $value) {
        if (strpos($key, 'wordpress_logged_in_') === 0) {
            return true;
        }
    }
    return false;
}

function dropin_remove_ignore_params($slug)
{
    $tracking_params = ignoreParams::$query_params;

    // Parse the provided slug
    $url_parts = parse_url($slug);
    
    // Get the current URL parameters
    $url_params = array();
    if (isset($url_parts['query'])) {
        parse_str($url_parts['query'], $url_params);
    }
    
    // Remove specified tracking parameters from the URL
    foreach ($tracking_params as $param) {
        $param = trim($param);
        if (isset($url_params[$param])) {
            unset($url_params[$param]);
        }
    }

    // Build the new query string
    $new_query_string = http_build_query($url_params);

    // Reconstruct the URL with the new query string
    $new_slug = $url_parts['path'];
    if (!empty($new_query_string)) {
        $new_slug .= '?' . $new_query_string;
    }

    return $new_slug;
}
```
