PATH:
home
/
sparklp6
/
public_html
/
website_356c8563
/
nitropack
/
classes
/
Integration
/
Hosting
<?php namespace NitroPack\Integration\Hosting; class Pressable extends Hosting { const STAGE = "very_early"; private $deviceTypes = ["mobile", "tablet", "desktop"]; private $configuredCacheGroups = false; public static function detect() { return isset($_SERVER["PRESSABLE_PROXIED_REQUEST"]) || strpos(gethostname(), "atomicsites.net") !== false; } public function init($stage) { if ($this->getHosting() == "pressable") { switch ($stage) { case "very_early": $this->noCache(); add_action('nitropack_cacheable_cache_headers', [$this, 'cacheShort']); add_action('nitropack_cachehit_cache_headers', [$this, 'cacheLong']); \NitroPack\ModuleHandler::initSemAcquire(); return true; case "early": \NitroPack\ModuleHandler::initSemRelease(); add_action('nitropack_execute_purge_url', [$this, 'purgeUrl']); add_action('nitropack_execute_purge_all', [$this, 'purgeAll']); return; default: return; } } } public function noCache() { global $batcache; if (!empty($batcache) && is_object($batcache)) { $batcache->max_age = 0; } } public function cacheShort() { global $batcache; if (!empty($batcache) && is_object($batcache)) { $batcache->max_age = 30; } } public function cacheLong() { global $batcache; if (!empty($batcache) && is_object($batcache)) { $batcache->max_age = 300; } } public function purgeUrl($url) { global $batcache; if (!$batcache || !is_object($batcache)) return; $urlObj = new \NitroPack\Url\Url($url); if ($urlObj->getHost()) { parse_str($urlObj->getQuery(), $query); foreach ($batcache->ignored_query_args as $arg) { unset($query[$arg]); } ksort($query); $keys = array( 'host' => $urlObj->getHost(), 'method' => "GET", 'path' => $urlObj->getPath(), 'query' => $query, 'extra' => [] ); if ( isset( $batcache->origin ) ) { $keys['origin'] = $batcache->origin; } if ( $urlObj->getScheme() == "https" ) $keys['ssl'] = true; wp_cache_init(); $batcache->configure_groups(); foreach ($this->deviceTypes as $deviceType) { $keys["extra"] = [$deviceType]; $url_key = md5(serialize($keys)); wp_cache_delete( $url_key, $batcache->group ); } } } public function purgeAll() { wp_cache_flush(); } }
[-] Closte.php
[edit]
[-] Savvii.php
[edit]
[-] Pantheon.php
[edit]
[-] .htaccess
[edit]
[-] Pagely.php
[edit]
[-] WPEngine.php
[edit]
[-] Hosting.php
[edit]
[-] Kinsta.php
[edit]
[-] RocketNet.php
[edit]
[-] Flywheel.php
[edit]
[-] SiteGround.php
[edit]
[-] Cloudways.php
[edit]
[-] SpinupWp.php
[edit]
[-] DreamHost.php
[edit]
[-] Vimexx.php
[edit]
[-] GridPane.php
[edit]
[-] GoDaddyWPaaS.php
[edit]
[-] WPX.php
[edit]
[-] WPmudev.php
[edit]
[-] PagelyCachePurge.php
[edit]
[-] Raidboxes.php
[edit]
[+]
..
[-] Pressable.php
[edit]