__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace WP_Statistics\Utils;
use WP_Statistics\Utils\Url;
class Env
{
/**
* Check if the current environment is local development
*
* @return bool True if running locally, false otherwise
*/
public static function isLocal()
{
// Check common local development domains
$localDomains = array(
'localhost',
'127.0.0.1',
'::1',
'local.dev',
'local.wp',
'*.loc',
'*.test',
'*.local',
);
// Get current site URL and parse the host
$siteUrl = Url::getDomain(home_url());
// Check against local domains
foreach ($localDomains as $domain) {
// Handle wildcard domains
if (strpos($domain, '*') !== false) {
$pattern = '/^' . str_replace('\*', '.*', preg_quote($domain, '/')) . '$/';
if (preg_match($pattern, $siteUrl)) {
return true;
}
} // Exact match
elseif (strtolower($siteUrl) === strtolower($domain)) {
return true;
}
}
// Additional checks for common local environment indicators
if (defined('WP_ENVIRONMENT_TYPE') && WP_ENVIRONMENT_TYPE === 'local') {
return true;
}
if (isset($_SERVER['REMOTE_ADDR']) && in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
return true;
}
// Check for common local server software
if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'localhost') !== false) {
return true;
}
return false;
}
}| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Env.php | File | 1.68 KB | 0644 |
|
| Query.php | File | 25.05 KB | 0644 |
|
| Request.php | File | 8.58 KB | 0644 |
|
| Signature.php | File | 805 B | 0644 |
|
| Url.php | File | 4.38 KB | 0644 |
|