Skip to content

Commit f608157

Browse files
Updating plugin to use latest crowdhandler-php-sdk release
1 parent 3145b60 commit f608157

5 files changed

Lines changed: 38 additions & 81 deletions

File tree

README.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: rickmutt
33
Tags: waiting room, traffic management, queue management, ecommerce, CrowdHandler,
44
Tested up to: 6.0
5-
Stable tag: 1.1.8
5+
Stable tag: 1.1.9
66
License: GPLv2 or later
77
License URI: http://www.gnu.org/licenses/gpl-2.0.html
88

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

9090

9191
== Changelog ==
92+
= 1.1.9 =
93+
* Compatibility change for crowdhHandler-php-skd release 1.05
9294
= 1.1.8 =
9395
* Compatible with WP v6.0
9496
= 1.1.7 =
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
class CrowdhandlerDiagnostics
4+
{
5+
6+
/**
7+
* @var array
8+
*/
9+
private $options;
10+
11+
public function __construct()
12+
{
13+
if (function_exists('get_option')) {
14+
$this->options = get_option('crowdhandler_settings');
15+
}
16+
}
17+
18+
/**
19+
* Adds a crowdhandler header to the request
20+
*/
21+
public function addCHDiagnostics($headers)
22+
{
23+
if($this->options){
24+
$indexOverride = (isset($this->options['crowdhandler_settings_field_override_index'])) ? '1' : '0';
25+
$timestamp = new DateTime();
26+
$formatedTime = $timestamp->format(DateTime::ISO8601);
27+
$headers['x-crowdhandler-info'] = $this->options['crowdhandler_settings_field_public_key'] . '::' . $indexOverride . '::' . $formatedTime;
28+
}
29+
return $headers;
30+
}
31+
}

includes/class-crowdhandler-gatekeeper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function checkRequest()
4444
}
4545

4646
$api = new PublicClient($this->options['crowdhandler_settings_field_public_key']);
47-
$this->gateKeeper = new CrowdHandlerWordPressGateKeeper($api);
47+
$this->gateKeeper = new GateKeeper($api);
4848

4949
$this->gateKeeper->setIgnoreUrls(
5050
"/^((?!.*\?).*(\.(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=.+/"
@@ -55,7 +55,6 @@ public function checkRequest()
5555
if (!$isHostServer) {
5656
$this->gateKeeper->setFailTrust(true);
5757
$this->gateKeeper->checkRequest();
58-
$this->gateKeeper->setCookie();
5958
$this->gateKeeper->redirectIfNotPromoted();
6059
}
6160

includes/class-crowdhandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ private function define_public_hooks()
169169
$this->loader->add_action('plugins_loaded', $plugin_public, 'checkRequest');
170170
$this->loader->add_action('shutdown', $plugin_public, 'recordPerformance');
171171
}
172+
173+
$diagnostics = new CrowdhandlerDiagnostics();
174+
$this->loader->add_filter('wp_headers', $diagnostics, 'addCHDiagnostics', 999);
172175
}
173176

174177
/**

includes/class-wordpress-gatekeeper.php

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)