updated plgntls :

- renamed PLGNTLS_class -> Plgntls
- changed method 'add_to_front()' to static method
- moved fetch script as inline script, so the plgntls file is single
- improved the way inline script and styles are added
This commit is contained in:
asus
2024-03-29 21:56:12 +01:00
parent 42e8cbc4e9
commit ade0be87ce
41 changed files with 457 additions and 421 deletions

View File

@@ -44,7 +44,7 @@ if (!defined('ABSPATH')) {
function get_field_init_CIPF($acf_field_name, $acf_id) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
$acf_state = get_field($acf_field_name, $acf_id);
if ($acf_state !== null) {
return $acf_state;
@@ -80,7 +80,7 @@ function get_field_init_CIPF($acf_field_name, $acf_id) {
*
*/
function is_acf_state_CIPF($acf_field, $state_name, $user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
if (is_null($user_id)) {
$user_id = get_current_user_id();
@@ -108,7 +108,7 @@ function is_acf_state_CIPF($acf_field, $state_name, $user_id = null) {
return false;
}
function set_acf_state_CIPF($acf_field, $state_name, $user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
if (is_null($user_id)) {
$user_id = get_current_user_id();
@@ -137,37 +137,37 @@ function set_acf_state_CIPF($acf_field, $state_name, $user_id = null) {
*
*/
function is_account_state_CIPF($state_name, $user_id = null) {
PLGNTLS_class::debug_infos();
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
Plgntls::debug_infos();
$acf_account_state = Plgntls::ACF_ACCOUNT_STATE;
return is_acf_state_CIPF($acf_account_state, $state_name, $user_id);
}
function is_account_new_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_account_state_CIPF('new', $user_id);
}
function is_account_to_pay_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_account_state_CIPF('to_pay', $user_id);
}
function is_account_valid_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_account_state_CIPF('valid', $user_id);
}
function is_account_waiting_invalid_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_account_state_CIPF('waiting_invalid', $user_id);
}
function is_account_waiting_valid_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_account_state_CIPF('waiting_valid', $user_id);
}
function is_account_expired_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_account_state_CIPF('expired', $user_id);
}
// additional : check both waitings
function is_account_waiting_transfert_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
if (is_account_waiting_valid_CIPF($user_id)) {
return true;
}
@@ -180,32 +180,32 @@ function is_account_waiting_transfert_CIPF($user_id = null) {
* setters :
*/
function set_account_state_CIPF($state_name, $user_id = null) {
PLGNTLS_class::debug_infos();
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
Plgntls::debug_infos();
$acf_account_state = Plgntls::ACF_ACCOUNT_STATE;
set_acf_state_CIPF($acf_account_state, $state_name, $user_id);
}
function set_account_new_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_account_state_CIPF('new', $user_id);
}
function set_account_to_pay_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_account_state_CIPF('to_pay', $user_id);
}
function set_account_valid_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_account_state_CIPF('valid', $user_id);
}
function set_account_waiting_invalid_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_account_state_CIPF('waiting_invalid', $user_id);
}
function set_account_waiting_valid_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_account_state_CIPF('waiting_valid', $user_id);
}
function set_account_expired_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_account_state_CIPF('expired', $user_id);
}
@@ -221,23 +221,23 @@ function set_account_expired_CIPF($user_id = null) {
*
*/
function is_card_new_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
Plgntls::debug_infos();
$acf_card_state = Plgntls::ACF_CARD_STATE;
return is_acf_state_CIPF($acf_card_state, 'new', $user_id);
}
function is_card_renew_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
Plgntls::debug_infos();
$acf_card_state = Plgntls::ACF_CARD_STATE;
return is_acf_state_CIPF($acf_card_state, 'renew', $user_id);
}
function set_card_new_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
Plgntls::debug_infos();
$acf_card_state = Plgntls::ACF_CARD_STATE;
set_acf_state_CIPF($acf_card_state, 'new', $user_id);
}
function set_card_renew_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
Plgntls::debug_infos();
$acf_card_state = Plgntls::ACF_CARD_STATE;
set_acf_state_CIPF($acf_card_state, 'renew', $user_id);
}
@@ -253,13 +253,13 @@ function set_card_renew_CIPF($user_id = null) {
*
*/
function is_payment_method_paypal_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_payment_method = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD;
Plgntls::debug_infos();
$acf_card_payment_method = Plgntls::ACF_CARD_PAYMENT_METHOD;
return is_acf_state_CIPF($acf_card_payment_method, 'paypal', $user_id);
}
function is_payment_method_transfert_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_payment_method = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD;
Plgntls::debug_infos();
$acf_card_payment_method = Plgntls::ACF_CARD_PAYMENT_METHOD;
return is_acf_state_CIPF($acf_card_payment_method, 'transfert', $user_id);
}
@@ -279,48 +279,48 @@ function is_payment_method_transfert_CIPF($user_id = null) {
*
*/
function is_payment_state_CIPF($type, $user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_payment_state = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
Plgntls::debug_infos();
$acf_card_payment_state = Plgntls::ACF_CARD_PAYMENT_STATE;
return is_acf_state_CIPF($acf_card_payment_state, $type, $user_id);
}
function is_payment_started_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_payment_state_CIPF('started', $user_id);
}
function is_payment_success_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_payment_state_CIPF('success', $user_id);
}
function is_payment_failure_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_payment_state_CIPF('failure', $user_id);
}
function is_payment_nothing_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
return is_payment_state_CIPF('nothing', $user_id);
}
/*
* setters
*/
function set_payment_state_CIPF($type, $user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_payment_state = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
Plgntls::debug_infos();
$acf_card_payment_state = Plgntls::ACF_CARD_PAYMENT_STATE;
set_acf_state_CIPF($acf_card_payment_state, $type, $user_id);
}
function set_payment_started_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_payment_state_CIPF('started', $user_id);
}
function set_payment_success_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_payment_state_CIPF('success', $user_id);
}
function set_payment_failure_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_payment_state_CIPF('failure', $user_id);
}
function set_payment_nothing_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
set_payment_state_CIPF('nothing', $user_id);
}
@@ -333,8 +333,8 @@ function set_payment_nothing_CIPF($user_id = null) {
*
*/
function set_card_number_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_card_number = PLGNTLS_class::ACF_CARD_NUMBER;
Plgntls::debug_infos();
$acf_card_number = Plgntls::ACF_CARD_NUMBER;
if (is_null($user_id)) {
$user_id = get_current_user_id();
@@ -355,8 +355,8 @@ function set_card_number_CIPF($user_id = null) {
*
*/
function reset_acf_cgv_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_cgv = PLGNTLS_class::ACF_PROF_CGV;
Plgntls::debug_infos();
$acf_cgv = Plgntls::ACF_PROF_CGV;
if (is_null($user_id)) {
$user_id = get_current_user_id();
@@ -374,8 +374,8 @@ function reset_acf_cgv_CIPF($user_id = null) {
*
*/
function is_transfert_success_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE;
Plgntls::debug_infos();
$acf_transfert_state = Plgntls::ACF_TRANSFERT_STATE;
if (is_null($user_id)) {
$user_id = get_current_user_id();
@@ -400,8 +400,8 @@ function is_transfert_success_CIPF($user_id = null) {
}
}
function reset_acf_transfert_CIPF($user_id = null) {
PLGNTLS_class::debug_infos();
$acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE;
Plgntls::debug_infos();
$acf_transfert_state = Plgntls::ACF_TRANSFERT_STATE;
if (is_null($user_id)) {
$user_id = get_current_user_id();