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
7 changes: 6 additions & 1 deletion inc/cleantalk-integrations-by-route.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
'rest_route' => '/wp-recipe-maker/v1/user-rating/',
'setting' => 'forms__contact_forms_test',
'rest' => true,
)
),
'HivePress' => array(
'rest_route' => '/hivepress/v1/listings/',
'setting' => 'forms__contact_forms_test',
'rest' => true,
),
);

add_filter('rest_pre_dispatch', function ($result, $_, $request) use ($apbct_active_rest_integrations) {
Expand Down
5 changes: 5 additions & 0 deletions inc/cleantalk-pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,11 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms')
) {
return 'AsgarosForum';
}

// Plugin Name: HivePress
if ( apbct_is_plugin_active('hivepress/hivepress.php') && apbct_is_in_uri('/hivepress/v1/listings/')) {
return 'Plugin Name: HivePress skip REST route checking';
}
}

// WP Fusion Abandoned Cart Addon
Expand Down
18 changes: 0 additions & 18 deletions inc/cleantalk-public-validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,6 @@ function ct_contact_form_validate()
return false;
}

//hivepress theme listing integration
if ( empty($sender_email) &&
function_exists('hivepress') &&
is_callable('hivepress') &&
apbct_is_user_logged_in() &&
$apbct->settings['data__protect_logged_in']
) {
if (! isset($_POST['_model'])) {
$current_user = wp_get_current_user();
if ( ! empty($current_user->data->user_email) ) {
$sender_email = $current_user->data->user_email;
}
} else {
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '(hivepress theme listing integration):' . __LINE__, $_POST);
return false;
}
}

//tellallfriend integration #1
if ( isset($_POST['TellAFriend_Link']) ) {
$tmp = Sanitize::cleanTextField(Post::get('TellAFriend_Link'));
Expand Down
44 changes: 44 additions & 0 deletions lib/Cleantalk/Antispam/Integrations/HivePress.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace Cleantalk\Antispam\Integrations;

class HivePress extends IntegrationBase
{
public function getDataForChecking($argument)
{
global $apbct;

if (
! apbct_is_plugin_active('hivepress/hivepress.php') ||
! apbct_is_user_logged_in() ||
! $apbct->settings['data__protect_logged_in']
) {
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '(hivepress theme listing integration):' . __LINE__, $_POST);
return null;
}

$sender_email = '';
$current_user = wp_get_current_user();
if ( ! empty($current_user->data->user_email) ) {
$sender_email = $current_user->data->user_email;
}

$data = ct_gfa_dto(apply_filters('apbct__filter_post', $argument), $sender_email)->getArray();
return $data;
}

public function allow()
{
return null;
}

public function doBlock($message)
{
wp_send_json(
[
'error' => ['message' => $message],
]
);
die();
}
}
Loading