Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions inc/cleantalk-integrations-by-route.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
'setting' => 'forms__contact_forms_test',
'rest' => true,
),
'HivePressRegistration' => array(
'rest_route' => '/hivepress/v1/users',
'setting' => 'forms__registrations_test',
'rest' => true,
),
);

add_filter('rest_pre_dispatch', function ($result, $_, $request) use ($apbct_active_rest_integrations) {
Expand Down
5 changes: 4 additions & 1 deletion inc/cleantalk-pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1968,7 +1968,10 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms')
}

// Plugin Name: HivePress
if ( apbct_is_plugin_active('hivepress/hivepress.php') && apbct_is_in_uri('/hivepress/v1/listings/')) {
if (
apbct_is_plugin_active('hivepress/hivepress.php') &&
(apbct_is_in_uri('/hivepress/v1/listings/') || apbct_is_in_uri('/hivepress/v1/users'))
) {
return 'Plugin Name: HivePress skip REST route checking';
}
}
Expand Down
40 changes: 40 additions & 0 deletions lib/Cleantalk/Antispam/Integrations/HivePressRegistration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Cleantalk\Antispam\Integrations;

use Cleantalk\Antispam\Integrations\IntegrationBase;

class HivePressRegistration extends IntegrationBase
{
/**
* @inheritDoc
*/
public function getDataForChecking($argument)
{
if (
! apbct_is_plugin_active('hivepress/hivepress.php') ||
! isset($argument['email'])
) {
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '(hivepress registration integration):' . __LINE__, $_POST);
return null;
}

return [
'email' => $argument['email'],
'register' => true
];
}

/**
* @inheritDoc
*/
public function doBlock($message)
{
wp_send_json(
[
'error' => ['message' => $message],
]
);
die();
}
}