| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/baberankings.com/wp-content/plugins/w3-total-cache/ |
Upload File : |
<?php
/**
* File: Mobile_Referrer.php
*
* @package W3TC
*/
namespace W3TC;
defined( 'ABSPATH' ) || exit;
// W3TC Referrer detection.
define( 'W3TC_REFERRER_COOKIE_NAME', 'w3tc_referrer' );
/**
* Class Mobile_Referrer
*/
class Mobile_Referrer extends Mobile_Base {
/**
* Constructs the Mobile_Referrer object.
*
* Initializes the parent class with specific group and referrer settings.
*
* @return void
*/
public function __construct() {
parent::__construct( 'referrer.rgroups', 'referrers' );
}
/**
* Retrieves the HTTP referrer from cookies or the server.
*
* If enabled groups are present, attempts to get the HTTP referrer from a cookie or the server.
* Sets or clears cookies based on conditions.
*
* @return string The sanitized HTTP referrer or an empty string if not available.
*/
public function get_http_referrer() {
$http_referrer = '';
if ( $this->has_enabled_groups() ) {
if ( isset( $_COOKIE[ W3TC_REFERRER_COOKIE_NAME ] ) ) {
$http_referrer = htmlspecialchars( $_COOKIE[ W3TC_REFERRER_COOKIE_NAME ] ); // phpcs:ignore
} elseif ( isset( $_SERVER['HTTP_REFERER'] ) ) {
$http_referrer = filter_var( $_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL ); // phpcs:ignore
Util_Cookie::set( W3TC_REFERRER_COOKIE_NAME, $http_referrer, 0, '/' );
}
} elseif ( isset( $_COOKIE[ W3TC_REFERRER_COOKIE_NAME ] ) ) {
// Pass the same explicit `/` path used by the set() branch
// above. Without it the clear() picks up COOKIEPATH, and on
// sites where COOKIEPATH differs from `/` the browser keeps
// the path-`/` cookie alive forever (set-cookie matches on
// (name, path, domain)).
Util_Cookie::clear( W3TC_REFERRER_COOKIE_NAME, '/' );
}
return $http_referrer;
}
/**
* Verifies if the HTTP referrer matches a specified group comparison value.
*
* Uses a static reference to store the HTTP referrer for efficient reuse.
* Matches the referrer against a regular expression provided in `$group_compare_value`.
*
* @param string $group_compare_value The regex pattern to compare against the HTTP referrer.
*
* @return bool True if the referrer matches the provided pattern, false otherwise.
*/
public function group_verifier( $group_compare_value ) {
static $http_referrer = null;
if ( is_null( $http_referrer ) ) {
$http_referrer = $this->get_http_referrer();
}
return $http_referrer && preg_match( '~' . $group_compare_value . '~i', $http_referrer );
}
/**
* Retrieves the group HTTP referrer.
*
* This method acts as a wrapper for `get_http_referrer`.
*
* @return string The sanitized HTTP referrer.
*/
public function do_get_group() {
return $this->get_http_referrer();
}
}