| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Services\Integrations; |
| 4 |
|
| 5 |
|
| 6 |
/** |
| 7 |
* @deprecated deprecated use FluentForm\App\Http\Controllers\GlobalIntegrationController; |
| 8 |
*/ |
| 9 |
|
| 10 |
|
| 11 |
trait LogResponseTrait |
| 12 |
{ |
| 13 |
protected function logResponse($response, $feed, $data, $form, $entryId, $status) |
| 14 |
{ |
| 15 |
if (! $response) { |
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
$prefix = 'fluentform/after_submission_api_response_'; |
| 20 |
$action = $prefix . $status; |
| 21 |
|
| 22 |
do_action_deprecated( |
| 23 |
'fluentform_after_submission_api_response_'. $status, |
| 24 |
[ |
| 25 |
$form, |
| 26 |
$entryId, |
| 27 |
$data, |
| 28 |
$feed, |
| 29 |
$response, |
| 30 |
$this->getApiResponseMessage($response, $status) |
| 31 |
], |
| 32 |
FLUENTFORM_FRAMEWORK_UPGRADE, |
| 33 |
$action, |
| 34 |
'Use ' . $action . ' instead of fluentform_after_submission_api_response_'. $status |
| 35 |
); |
| 36 |
|
| 37 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- Dynamic hook name constructed from deprecated hook |
| 38 |
do_action( |
| 39 |
$action, // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- Dynamic hook name constructed from deprecated hook |
| 40 |
$form, |
| 41 |
$entryId, |
| 42 |
$data, |
| 43 |
$feed, |
| 44 |
$response, |
| 45 |
$this->getApiResponseMessage($response, $status) |
| 46 |
); |
| 47 |
} |
| 48 |
|
| 49 |
protected function getApiResponseMessage($response, $status) |
| 50 |
{ |
| 51 |
if (is_array($response) && isset($response['message'])) { |
| 52 |
return $response['message']; |
| 53 |
} |
| 54 |
|
| 55 |
return $status; |
| 56 |
} |
| 57 |
} |
| 58 |
|