PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.6
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.6
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / inc / dropin-functions.php

dropin-functions.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.6, at inc/dropin-functions.php

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function bwp_is_ajax() {
4 return
5 (function_exists("wp_doing_ajax") && wp_doing_ajax()) ||
6 (defined('DOING_AJAX') && DOING_AJAX) ||
7 (!empty($_SERVER["HTTP_X_REQUESTED_WITH"]) && $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest") ||
8 (!empty($_SERVER["REQUEST_URI"]) && basename($_SERVER["REQUEST_URI"]) == "admin-ajax.php") ||
9 !empty($_GET["wc-ajax"]);
10 }
11
12 function bwp_is_user_logged_in() {
13 foreach ($_COOKIE as $key => $value) {
14 if (strpos($key, 'wordpress_logged_in_') === 0) {
15 return true;
16 }
17 }
18 return false;
19 }
20
21 function dropin_remove_ignore_params($slug)
22 {
23 $tracking_params = ignoreParams::$query_params;
24
25 // Parse the provided slug
26 $url_parts = parse_url($slug);
27
28 // Get the current URL parameters
29 $url_params = array();
30 if (isset($url_parts['query'])) {
31 parse_str($url_parts['query'], $url_params);
32 }
33
34 // Remove specified tracking parameters from the URL
35 foreach ($tracking_params as $param) {
36 $param = trim($param);
37 if (isset($url_params[$param])) {
38 unset($url_params[$param]);
39 }
40 }
41
42 // Build the new query string
43 $new_query_string = http_build_query($url_params);
44
45 // Reconstruct the URL with the new query string
46 $new_slug = $url_parts['path'];
47 if (!empty($new_query_string)) {
48 $new_slug .= '?' . $new_query_string;
49 }
50
51 return $new_slug;
52 }