| @@ -1,33 +1,57 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentForm\App\Services\Integrations; |
| 4 | 4 | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @deprecated deprecated use FluentForm\App\Http\Controllers\GlobalIntegrationController; | |
| 8 | + */ | |
| 9 | + | |
| 10 | + | |
| 5 | 11 | trait LogResponseTrait |
| 6 | 12 | { |
| 7 | - protected function logResponse($response, $feed, $data, $form, $entryId, $status) | |
| 8 | - { | |
| 9 | - if (!$response) return; | |
| 13 | + protected function logResponse($response, $feed, $data, $form, $entryId, $status) | |
| 14 | + { | |
| 15 | + if (! $response) { | |
| 16 | + return; | |
| 17 | + } | |
| 10 | 18 | |
| 11 | - $prefix = 'fluentform_after_submission_api_response_'; | |
| 12 | - $action = $prefix . $status; | |
| 19 | + $prefix = 'fluentform/after_submission_api_response_'; | |
| 20 | + $action = $prefix . $status; | |
| 13 | 21 | |
| 14 | - do_action( | |
| 15 | - $action, | |
| 16 | - $form, | |
| 17 | - $entryId, | |
| 18 | - $data, | |
| 19 | - $feed, | |
| 20 | - $response, | |
| 21 | - $this->getApiResponseMessage($response, $status) | |
| 22 | - ); | |
| 23 | - } | |
| 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 | + ); | |
| 24 | 36 | |
| 25 | - protected function getApiResponseMessage($response, $status) | |
| 26 | - { | |
| 27 | - if (is_array($response) && isset($response['message'])) { | |
| 28 | - return $response['message']; | |
| 29 | - } | |
| 30 | - | |
| 31 | - return $status; | |
| 32 | - } | |
| 33 | -} | |
| 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 | +} | |