v 0.3.4 states are now handled with specific functions for setting, getting, and adding css
This commit is contained in:
@@ -60,7 +60,7 @@ function update_user_pre_order_CIPF($message) {
|
||||
* - 'nothing' -> output nothing on author page
|
||||
*
|
||||
*/
|
||||
set_payment_started($user_id);
|
||||
set_payment_started_CIPF($user_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ function failure_payment_for_user_CIPF($user_id, $order_id, $status) {
|
||||
delete_user_meta($user_id, $meta_order_id, $order_id);
|
||||
|
||||
|
||||
set_payment_failure($user_id);
|
||||
set_payment_failure_CIPF($user_id);
|
||||
set_account_to_pay_CIPF($user_id);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ function success_payment_for_user_CIPF($user_id, $order_id) {
|
||||
}
|
||||
set_card_renew_CIPF($user_id);
|
||||
|
||||
set_payment_success($user_id);
|
||||
set_payment_success_CIPF($user_id);
|
||||
set_account_valid_CIPF($user_id);
|
||||
}
|
||||
|
||||
|
||||
101
plugins/cipf_plugin/php/profs_display_css.php
Normal file
101
plugins/cipf_plugin/php/profs_display_css.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?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!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function prof_display_css_CIPF() {
|
||||
$css_for_states = array();
|
||||
|
||||
/*
|
||||
* etat paiement
|
||||
* - 'en_cours'
|
||||
* - 'reussi'
|
||||
* - 'echec'
|
||||
* - 'aucun'
|
||||
*/
|
||||
if (is_payment_success_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/paiement_reussi.css';
|
||||
set_payment_nothing_CIPF();
|
||||
}
|
||||
else if (is_payment_failure_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/paiement_echec.css';
|
||||
set_payment_nothing_CIPF();
|
||||
}
|
||||
else if (is_payment_started_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/paiement_en_cours.css';
|
||||
}
|
||||
else if (is_payment_nothing_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/paiement_aucun.css';
|
||||
}
|
||||
|
||||
/*
|
||||
* etat compte ('etat_compte') :
|
||||
* 1. new . 'nouveau prof'
|
||||
* 2. to_pay . 'doit payer'
|
||||
* 3. valid . 'carte valide'
|
||||
* 4. waiting_invalid . 'en attente invalide'
|
||||
* 5. waiting_valid . 'en attente valide'
|
||||
* 6. expired . 'carte expiree'
|
||||
*/
|
||||
if (is_account_new_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/compte_nouveau_prof.css';
|
||||
}
|
||||
else if (is_account_to_pay_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/compte_doit_payer.css';
|
||||
}
|
||||
else if (is_account_valid_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/compte_carte_valide.css';
|
||||
}
|
||||
else if (is_account_waiting_invalid_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/compte_en_attente_invalide.css';
|
||||
}
|
||||
else if (is_account_waiting_valid_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/compte_en_attente_valide.css';
|
||||
}
|
||||
else if (is_account_expired_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/compte_carte_expiree.css';
|
||||
}
|
||||
|
||||
/*
|
||||
* etat carte
|
||||
* - 'Commande'
|
||||
* - 'Renouvellement'
|
||||
*
|
||||
*/
|
||||
if (is_card_new_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/carte_commande.css';
|
||||
}
|
||||
else if (is_card_renew_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/carte_renouvellement.css';
|
||||
}
|
||||
|
||||
/*
|
||||
* paiement
|
||||
* - 'Paypal'
|
||||
* - 'Virement'
|
||||
*
|
||||
*/
|
||||
if (is_payment_method_paypal_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/type_paypal.css';
|
||||
}
|
||||
else if (is_payment_method_transfert_CIPF()) {
|
||||
$css_for_states[] = 'css/display_states/type_virement.css';
|
||||
}
|
||||
|
||||
|
||||
return $css_for_states;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -177,11 +177,8 @@ function prof_profil_scripts_CIPF() {
|
||||
$author_id = get_queried_object_id();
|
||||
$cipf_prof = new PLGNTLS_class();
|
||||
|
||||
$cipf_prof->add_to_front(
|
||||
array(
|
||||
'css/display_states/paiement_reussi.css',
|
||||
)
|
||||
);
|
||||
$css_front_states = prof_display_css_CIPF();
|
||||
$cipf_prof->add_to_front($css_front_states);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'prof_profil_scripts_CIPF', 11);
|
||||
|
||||
|
||||
@@ -231,19 +231,19 @@ function is_payment_state_CIPF($user_id = null, $type) {
|
||||
$acf_card_payment_state = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
|
||||
return is_acf_state_CIPF($user_id, $acf_card_payment_state, $type);
|
||||
}
|
||||
function is_payment_started($user_id = null) {
|
||||
function is_payment_started_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
return is_payment_state_CIPF($user_id, 'started');
|
||||
}
|
||||
function is_payment_success($user_id = null) {
|
||||
function is_payment_success_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
return is_payment_state_CIPF($user_id, 'success');
|
||||
}
|
||||
function is_payment_failure($user_id = null) {
|
||||
function is_payment_failure_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
return is_payment_state_CIPF($user_id, 'failure');
|
||||
}
|
||||
function is_payment_nothing($user_id = null) {
|
||||
function is_payment_nothing_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
return is_payment_state_CIPF($user_id, 'nothing');
|
||||
}
|
||||
@@ -255,19 +255,19 @@ function set_payment_state_CIPF($user_id = null, $type) {
|
||||
$acf_card_payment_state = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
|
||||
set_acf_state_CIPF($user_id, $acf_card_payment_state, $type);
|
||||
}
|
||||
function set_payment_started($user_id = null) {
|
||||
function set_payment_started_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
set_payment_state_CIPF($user_id, 'started');
|
||||
}
|
||||
function set_payment_success($user_id = null) {
|
||||
function set_payment_success_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
set_payment_state_CIPF($user_id, 'success');
|
||||
}
|
||||
function set_payment_failure($user_id = null) {
|
||||
function set_payment_failure_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
set_payment_state_CIPF($user_id, 'failure');
|
||||
}
|
||||
function set_payment_nothing($user_id = null) {
|
||||
function set_payment_nothing_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
set_payment_state_CIPF($user_id, 'nothing');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user