95 lines
1.5 KiB
PHP
95 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!');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* early checks on payment page
|
|
*
|
|
*/
|
|
function payment_page_checks_CIPF() {
|
|
PLGNTLS_class::debug_infos();
|
|
$slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE;
|
|
|
|
// check the slug
|
|
global $wp;
|
|
$current_slug = $wp->request;
|
|
if ($current_slug !== $slug_paypal_page) {
|
|
return;
|
|
}
|
|
|
|
// get the user id
|
|
$user_id = get_current_user_id();
|
|
|
|
// do checks here
|
|
}
|
|
add_action('wp', 'payment_page_checks_CIPF');
|
|
|
|
|
|
|
|
|
|
/*
|
|
* if profil needs redirection, it happens here
|
|
*
|
|
*/
|
|
function payment_page_redirects_CIPF() {
|
|
PLGNTLS_class::debug_infos();
|
|
$slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE;
|
|
|
|
// check the slug
|
|
global $wp;
|
|
$current_slug = $wp->request;
|
|
if ($current_slug !== $slug_paypal_page) {
|
|
return;
|
|
}
|
|
|
|
// get the user id
|
|
$user_id = get_current_user_id();
|
|
|
|
// do redirections here
|
|
|
|
}
|
|
add_action('template_redirect', 'payment_page_redirects_CIPF');
|
|
|
|
|
|
|
|
|
|
/*
|
|
* time to upload some scripts and styles on prof profil page
|
|
*
|
|
*/
|
|
function payment_page_scripts_CIPF() {
|
|
PLGNTLS_class::debug_infos();
|
|
$slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE;
|
|
|
|
// check the slug
|
|
global $wp;
|
|
$current_slug = $wp->request;
|
|
if ($current_slug !== $slug_paypal_page) {
|
|
return;
|
|
}
|
|
|
|
// get the user id
|
|
$user_id = get_current_user_id();
|
|
|
|
// enqueue files here
|
|
display_page_css_CIPF($user_id);
|
|
}
|
|
add_action('wp_enqueue_scripts', 'payment_page_scripts_CIPF');
|
|
|
|
|
|
|
|
|
|
?>
|
|
|