Skip to content
6 changes: 4 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== CrowdHandler virtual waiting room ===
Contributors: rickmutt
Tags: waiting room, traffic management, queue management, ecommerce, CrowdHandler,
Tested up to: 6.0
Stable tag: 1.1.8
Tested up to: 6.1.1
Stable tag: 1.1.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -89,6 +89,8 @@ You can uninstall the plugin at any time to remove CrowdHandler from your site.


== Changelog ==
= 1.1.9 =
* Compatibility change for crowdhHandler-php-skd release 1.0.5 and added crowdhandler diagnostics
= 1.1.8 =
* Compatible with WP v6.0
= 1.1.7 =
Expand Down
34 changes: 11 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crowdhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: CrowdHandler virtual waiting room
* Plugin URI: https://signup.crowdhandler.com/?utm_source=WordPress&utm_medium=Plugin_Dir
* Description: During periods of heavy traffic, our queue management solution helps safeguard your website from crashing and protects your sales.
* Version: 1.1.8
* Version: 1.1.9
* Author: CROWDHANDLER LTD
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Expand All @@ -38,7 +38,7 @@
* Start at version 0.1.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define('CROWDHANDLER_VERSION', '1.1.8');
define('CROWDHANDLER_VERSION', '1.1.9');

/**
* The code that runs during plugin activation.
Expand Down
31 changes: 31 additions & 0 deletions includes/class-crowdhandler-diagnostics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

class CrowdhandlerDiagnostics
{

/**
* @var array
*/
private $options;

public function __construct()
{
if (function_exists('get_option')) {
$this->options = get_option('crowdhandler_settings');
}
}

/**
* Adds a crowdhandler header to the request
*/
public function addCHDiagnostics($headers)
{
if($this->options){
$indexOverride = (isset($this->options['crowdhandler_settings_field_override_index'])) ? '1' : '0';
$timestamp = new DateTime();
$formatedTime = $timestamp->format(DateTime::ISO8601);
$headers['x-crowdhandler-info'] = $this->options['crowdhandler_settings_field_public_key'] . '::' . $indexOverride . '::' . $formatedTime;
}
return $headers;
}
}
3 changes: 1 addition & 2 deletions includes/class-crowdhandler-gatekeeper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@ public function checkRequest()
$this->gateKeeper = new GateKeeper($api);

$this->gateKeeper->setIgnoreUrls(
"/^((?!.*\?).*(\.(avi|css|eot|gif|ico|jpg|jpeg|js|json|mov|mp4|mpeg|mpg|og[g|v]|pdf|png|svg|ttf|txt|wmv|woff|woff2|xml))$)|(?!.*\?.*w[c|p]-.+).*(^.*w[c|p]-.+)|^((?!.*\?.*xmlrpc\.php).*xmlrpc.php)|\?rest_route=.+/"
"/^((?!.*\?).*(\.(avi|css|eot|gif|ico|jpg|jpeg|js|json|mov|mp4|mpeg|mpg|og[g|v]|pdf|png|svg|tiff|ttf|txt|wmv|woff|woff2|xml))$)|.*(^.*w[c|p]-.+)|^((?!.*\?.*xmlrpc\.php).*xmlrpc.php)|\?rest_route=.+/"
);

$isHostServer = $this->gateKeeper->ip === $_SERVER["SERVER_ADDR"];

if (!$isHostServer) {
$this->gateKeeper->setFailTrust(true);
$this->gateKeeper->checkRequest();
$this->gateKeeper->setCookie();
$this->gateKeeper->redirectIfNotPromoted();
}

Expand Down
3 changes: 3 additions & 0 deletions includes/class-crowdhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ private function define_public_hooks()
$this->loader->add_action('plugins_loaded', $plugin_public, 'checkRequest');
$this->loader->add_action('shutdown', $plugin_public, 'recordPerformance');
}

$diagnostics = new CrowdhandlerDiagnostics();
$this->loader->add_filter('wp_headers', $diagnostics, 'addCHDiagnostics', 999);
}

/**
Expand Down