- struggled to make ajax works, but now is ok

- starting to make serverside works
This commit is contained in:
asus
2024-02-23 19:36:03 +01:00
parent 7cfa2e6351
commit b7685cbbc1
9 changed files with 428 additions and 37 deletions

View File

@@ -39,6 +39,7 @@ inclusions
include_once(PLGNTLS_class::get_path() . '/php/utils/globals.php');
include_once(PLGNTLS_class::get_path() . '/php/utils/console_log.php');
include_once(PLGNTLS_class::get_path() . '/php/menu/example_menu.php');
include_once(PLGNTLS_class::get_path() . '/php/paypal/paypal.php');
//include_once(PLGNTLS_class::get_path() . '/php/images/image_edit_shortcode.php');
//include_once(PLGNTLS_class::get_path() . '/php/images/image-edit.php');
@@ -162,6 +163,7 @@ add_shortcode('custom_frontend_posting_form', 'custom_frontend_posting_form');
/*
function check_paypal_request()
{
error_log("----");
@@ -181,29 +183,25 @@ function check_paypal_request()
// error_log(json_encode($_COOKIE));
}
add_action('template_redirect', 'check_paypal_request');
*/
function paypal_shortcode_content()
{
$fipfcard_paypal = new PLGNTLS_class();
/*
<input type="hidden" name="custom" value="5678" />
*/
$pp_live_client_id = "Aedn5e8z__hPBvKirqw5bwlhI9ChG8_N6c1xbgybYyBr4B4oP8uVzmVdH1QVKdPQKf6bWg7orPV4PDrO";
$pp_sandbox_client_id = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl";
$pp_client_id = $pp_live_client_id;
$pp_client_id = $pp_sandbox_client_id;
$pp_sdk_currency = "EUR";
$pp_sdk_debug = "true";
$pp_sdk_base_url="https://sandbox.paypal.com";
$pp_sdk_base_url="https://www.paypal.com";
$pp_sdk_client_token="abc123xyz==";
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=$pp_client_id&currency=$pp_sdk_currency&debug=$pp_sdk_debug";
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=$pp_client_id";
$pp_sdk_attributes="src='$pp_sdk_src' data-client-token='$pp_sdk_client_token'";
$pp_sdk_attributes="src='$pp_sdk_src'";
$pp_sdk_html_script="<script $pp_sdk_attributes></script>";
// $pp_sdk_client_token="abc123xyz==";
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=" . PAYPAL_CLIENT_ID . "&currency=$pp_sdk_currency&debug=$pp_sdk_debug";
$pp_sdk_src="$pp_sdk_base_url/sdk/js?client-id=" . PAYPAL_CLIENT_ID ;
// $pp_sdk_attributes="src='$pp_sdk_src' data-client-token='$pp_sdk_client_token'";
// $pp_sdk_attributes="src='$pp_sdk_src'";
// $pp_sdk_html_script="<script $pp_sdk_attributes></script>";
return $fipfcard_paypal->add_to_front(
array(
@@ -211,8 +209,6 @@ function paypal_shortcode_content()
"js/paypal/paypal.js",
"html/paypal/paypal.html",
),
compact(
),
);
}
add_shortcode('fipf_paypal_shortcode', 'paypal_shortcode_content');
@@ -493,5 +489,4 @@ function fipfcard_ajax_handler()
}
add_action( 'wp_ajax_get_data', 'fipfcard_ajax_handler' );
?>