| @@ -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 |
| @@ -281,8 +295,9 @@ | ||
| 281 | 295 | * Transaction property can be used to perform refunds, and it's collected |
| 282 | 296 | * and returned during charge/capture transactions only. |
| 283 | 297 | * |
| 284 | 298 | * @since 1.4.0 |
| 299 | + * @since 1.6.9 added support for "tot_fees". | |
| 285 | 300 | */ |
| 286 | 301 | |
| 287 | 302 | // manipulate the response to be compliant with the old payment system |
| 288 | 303 | $response = array( |
| @@ -287,8 +302,9 @@ | ||
| 287 | 302 | // manipulate the response to be compliant with the old payment system |
| 288 | 303 | $response = array( |
| 289 | 304 | 'verified' => (int) $status->isVerified(), |
| 290 | 305 | 'tot_paid' => $status->amount, |
| 306 | + 'tot_fees' => $status->fees, | |
| 291 | 307 | 'log' => $status->log, |
| 292 | 308 | 'transaction' => $status->transaction, |
| 293 | 309 | ); |
| 294 | 310 | |
| @@ -333,8 +349,28 @@ | ||
| 333 | 349 | 'log' => $status->log, |
| 334 | 350 | 'transaction' => $status->transaction, |
| 335 | 351 | ); |
| 336 | 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); | |
| 337 | 373 | } |
| 338 | 374 | |
| 339 | 375 | /** |
| 340 | 376 | * Registers all the widget contained within the modules folder. |
| @@ -530,8 +566,21 @@ | ||
| 530 | 566 | * @throws Exception |
| 531 | 567 | */ |
| 532 | 568 | add_action('vikbooking_before_import_backup', function($manifest, $path) use ($hasShortcodes) |
| 533 | 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 | + | |
| 534 | 583 | // check whether the manifest includes the shortcodes installation |
| 535 | 584 | $manifest->shortcodes = $hasShortcodes($manifest); |
| 536 | 585 | |
| 537 | 586 | if (empty($manifest->shortcodes)) |
| @@ -554,8 +603,13 @@ | ||
| 554 | 603 | { |
| 555 | 604 | // get post details |
| 556 | 605 | $post = get_post((int) $shortcode->post_id); |
| 557 | 606 | |
| 607 | + if (!$post) | |
| 608 | + { | |
| 609 | + continue; | |
| 610 | + } | |
| 611 | + | |
| 558 | 612 | // convert shortcode creation date |
| 559 | 613 | $shortcode->createdon = new JDate($shortcode->createdon); |
| 560 | 614 | // convert post creation date |
| 561 | 615 | $post->post_date_gmt = new JDate($post->post_date_gmt); |
| @@ -586,28 +640,25 @@ | ||
| 586 | 640 | * @throws Exception |
| 587 | 641 | */ |
| 588 | 642 | add_action('vikbooking_after_import_backup', function($manifest, $path) |
| 589 | 643 | { |
| 590 | - if (empty($manifest->shortcodes)) | |
| 644 | + if (!empty($manifest->shortcodes)) | |
| 591 | 645 | { |
| 592 | - // shortcodes not included within the backup, do not install | |
| 593 | - return; | |
| 594 | - } | |
| 646 | + // get shortcodes admin model | |
| 647 | + $listModel = JModel::getInstance('vikbooking', 'shortcodes', 'admin'); | |
| 595 | 648 | |
| 596 | - // get shortcodes admin model | |
| 597 | - $listModel = JModel::getInstance('vikbooking', 'shortcodes', 'admin'); | |
| 649 | + // get all existing shortcodes | |
| 650 | + $shortcodes = $listModel->all('id'); | |
| 598 | 651 | |
| 599 | - // get all existing shortcodes | |
| 600 | - $shortcodes = $listModel->all('id'); | |
| 652 | + // get shortcode admin model | |
| 653 | + $model = JModel::getInstance('vikbooking', 'shortcode', 'admin'); | |
| 601 | 654 | |
| 602 | - // get shortcode admin model | |
| 603 | - $model = JModel::getInstance('vikbooking', 'shortcode', 'admin'); | |
| 604 | - | |
| 605 | - // iterate all shortcodes found | |
| 606 | - foreach ($shortcodes as $shortcode) | |
| 607 | - { | |
| 608 | - // assign the shortcode to a new page | |
| 609 | - $model->addPage($shortcode->id); | |
| 655 | + // iterate all shortcodes found | |
| 656 | + foreach ($shortcodes as $shortcode) | |
| 657 | + { | |
| 658 | + // assign the shortcode to a new page | |
| 659 | + $model->addPage($shortcode->id); | |
| 660 | + } | |
| 610 | 661 | } |
| 611 | 662 | |
| 612 | 663 | // trigger full files mirroring |
| 613 | 664 | VikBookingUpdateManager::triggerUploadFullMirroring(); |