64 lines
1.5 KiB
PHP
64 lines
1.5 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()
|
|
{
|
|
$slug_paypal_redirection_success = PLGNTLS_class::SLUG_PAYPAL_REDIRECTION_SUCCESS;
|
|
$slug_paypal_redirection_failure = PLGNTLS_class::SLUG_PAYPAL_REDIRECTION_FAILURE;
|
|
$paypal_client_id = PLGNTLS_class::PAYPAL_CLIENT_ID;
|
|
$paypal_message_success = PLGNTLS_class::PAYPAL_MESSAGE_SUCCESS;
|
|
$paypal_message_failure = PLGNTLS_class::PAYPAL_MESSAGE_FAILURE;
|
|
|
|
// if (!can_pay_now_CIPF())
|
|
// return no_payment_CIPF();
|
|
$cipfcard_paypal = new PLGNTLS_class();
|
|
|
|
$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}¤cy={$pp_sdk_currency}";
|
|
|
|
$paypal_redirection_success = home_url() . '/' . $slug_paypal_redirection_success;
|
|
$paypal_redirection_failure = home_url() . '/' . $slug_paypal_redirection_failure;
|
|
|
|
$added_to_front = $cipfcard_paypal->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',
|
|
),
|
|
);
|
|
|
|
return $added_to_front;
|
|
}
|
|
add_shortcode('cipf_paypal_shortcode', 'paypal_shortcode_content_CIPF');
|
|
|
|
|
|
function no_payment_CIPF() {
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
?>
|