| @@ -24,8 +24,22 @@ | ||
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | 26 | public static function loadLanguage() |
| 27 | 27 | { |
| 28 | + static $loaded = false; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * Do not load the languages more than once. | |
| 32 | + * | |
| 33 | + * @since 1.8.4 | |
| 34 | + */ | |
| 35 | + if ($loaded) | |
| 36 | + { | |
| 37 | + return; | |
| 38 | + } | |
| 39 | + | |
| 40 | + $loaded = true; | |
| 41 | + | |
| 28 | 42 | $app = JFactory::getApplication(); |
| 29 | 43 | |
| 30 | 44 | /** |
| 31 | 45 | * @since 1.0.2 All the language files have been merged |
| @@ -335,8 +349,28 @@ | ||
| 335 | 349 | 'log' => $status->log, |
| 336 | 350 | 'transaction' => $status->transaction, |
| 337 | 351 | ); |
| 338 | 352 | }, 10, 3); |
| 353 | + | |
| 354 | + // manipulate response to be compliant with the off-session capturing requests | |
| 355 | + add_action('payment_after_offsession_capture_vikbooking', function($payment, $status, &$response) | |
| 356 | + { | |
| 357 | + /** | |
| 358 | + * Transaction property can be used to perform refunds, and it's collected | |
| 359 | + * and returned during charge/capture transactions only. | |
| 360 | + * | |
| 361 | + * @since 1.8.0 | |
| 362 | + */ | |
| 363 | + | |
| 364 | + // manipulate the response to be compliant with any platform | |
| 365 | + $response = array( | |
| 366 | + 'verified' => (int) $status->isVerified(), | |
| 367 | + 'tot_paid' => $status->amount, | |
| 368 | + 'tot_fees' => $status->fees ?? null, | |
| 369 | + 'log' => $status->log ?? null, | |
| 370 | + 'transaction' => $status->transaction ?? null, | |
| 371 | + ); | |
| 372 | + }, 10, 3); | |
| 339 | 373 | } |
| 340 | 374 | |
| 341 | 375 | /** |
| 342 | 376 | * Registers all the widget contained within the modules folder. |
| @@ -532,8 +566,21 @@ | ||
| 532 | 566 | * @throws Exception |
| 533 | 567 | */ |
| 534 | 568 | add_action('vikbooking_before_import_backup', function($manifest, $path) use ($hasShortcodes) |
| 535 | 569 | { |
| 570 | + if (!function_exists('is_plugin_active')) { | |
| 571 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 572 | + } | |
| 573 | + | |
| 574 | + /** | |
| 575 | + * Abort the backup import process in case Rank Math SEO plugin is installed and active. | |
| 576 | + * | |
| 577 | + * @since 1.8 | |
| 578 | + */ | |
| 579 | + if (is_plugin_active('seo-by-rank-math/rank-math.php')) { | |
| 580 | + throw new Exception('The <strong>Rank Math SEO</strong> plugin appears to be installed on your website. Before proceeding with the restoration, it is necessary to deactivate this plugin. Once the data installation is complete, you will be able to re-enable it.', 409); | |
| 581 | + } | |
| 582 | + | |
| 536 | 583 | // check whether the manifest includes the shortcodes installation |
| 537 | 584 | $manifest->shortcodes = $hasShortcodes($manifest); |
| 538 | 585 | |
| 539 | 586 | if (empty($manifest->shortcodes)) |