Files
2024_WEBSITE_fipf/plugins/cipf_plugin/php/paypal/shortcode.php

66 lines
1.6 KiB
PHP

<?php
/*
* it means someone outside wp is accessing the file, in this case kill it.
*/
if (!defined('ABSPATH')) {
die('You can not access this file!');
}
/**
* call to paypal_shortcode_content()
*/
function paypal_shortcode_content_CIPF() {
Plgntls::debug_infos();
$slug_paypal_redirection_success = Cipf::SLUG_PAYPAL_REDIRECTION_SUCCESS;
$slug_paypal_redirection_failure = Cipf::SLUG_PAYPAL_REDIRECTION_FAILURE;
$paypal_client_id = get_paypal_client_id_CIPF();
$paypal_message_success = get_payment_message_success_CIPF();
$paypal_message_failure = get_payment_message_failure_CIPF();
$paypal_message_problem = get_payment_message_problem_CIPF();
// if (!can_pay_now_CIPF())
// return no_payment_CIPF();
$pp_client_id = $paypal_client_id;
$pp_sdk_currency = "EUR";
$pp_sdk_base_url = "https://www.paypal.com";
$pp_sdk_url = "{$pp_sdk_base_url}/sdk/js?client-id={$pp_client_id}&currency={$pp_sdk_currency}";
$paypal_redirection_success = home_url() . '/' . $slug_paypal_redirection_success;
$paypal_redirection_failure = home_url() . '/' . $slug_paypal_redirection_failure;
$added_to_front = Plgntls::add_to_front(
array(
$pp_sdk_url,
array("js/paypal/paypal.js", 'type'=>'module'),
"html/paypal/paypal.html",
),
compact (
'paypal_redirection_success',
'paypal_redirection_failure',
'paypal_message_success',
'paypal_message_failure',
'paypal_message_problem',
),
);
return $added_to_front;
}
add_shortcode('cipf_paypal_shortcode', 'paypal_shortcode_content_CIPF');
function no_payment_CIPF() {
Plgntls::debug_infos();
return;
}
?>