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:
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
|
||||
* menu plugin
|
||||
*/
|
||||
function cipf_plugin_menu_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$menu_page_title = 'cipf';
|
||||
$menu_title = 'cipf';
|
||||
$menu_capability = 'manage_options';
|
||||
@@ -40,11 +40,11 @@ ajax
|
||||
use $_POST['property_name']
|
||||
*/
|
||||
//function cipfcard_menu_fetch_handler() {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// Plgntls::debug_infos();
|
||||
// return new WP_REST_Response('hello', 200);
|
||||
//}
|
||||
//function cipfcard_menu_endpoint() {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// Plgntls::debug_infos();
|
||||
// register_rest_route('plgntls', '/get_data', array(
|
||||
// 'methods' => 'POST',
|
||||
// 'callback' => 'cipfcard_menu_fetch_handler',
|
||||
|
||||
@@ -12,8 +12,8 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
function toggle_menu_CIPF($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU;
|
||||
Plgntls::debug_infos();
|
||||
$toggle_menu = Plgntls::TOGGLE_ADMIN_MENU;
|
||||
|
||||
if (false === get_option($toggle_menu['_name'])) {
|
||||
add_option($toggle_menu['_name'], $toggle_menu['hide'], '', 'no');
|
||||
@@ -39,9 +39,9 @@ function toggle_menu_CIPF($menu_page_title, $menu_title, $menu_capability, $menu
|
||||
*
|
||||
*/
|
||||
function add_link_to_custer_plugin_CIPF($links) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$slug_toggle = PLGNTLS_class::SLUG_TOOGLE_ADMIN_MENU;
|
||||
$toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU;
|
||||
Plgntls::debug_infos();
|
||||
$slug_toggle = Plgntls::SLUG_TOOGLE_ADMIN_MENU;
|
||||
$toggle_menu = Plgntls::TOGGLE_ADMIN_MENU;
|
||||
|
||||
$toggle = get_option($toggle_menu['_name']);
|
||||
|
||||
@@ -63,16 +63,16 @@ add_filter('plugin_action_links_cipf_plugin/cipf_plugin.php', 'add_link_to_custe
|
||||
*
|
||||
*/
|
||||
function toggle_custer_plugin_menu_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_toggle = PLGNTLS_class::SLUG_TOOGLE_ADMIN_MENU;
|
||||
$toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_toggle = Plgntls::SLUG_TOOGLE_ADMIN_MENU;
|
||||
$toggle_menu = Plgntls::TOGGLE_ADMIN_MENU;
|
||||
|
||||
global $wp;
|
||||
$current_slug = $wp->request;
|
||||
if ($current_slug !== $slug_toggle['_name']) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
$show = null;
|
||||
if (!isset($_GET)) {
|
||||
|
||||
@@ -11,34 +11,34 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
function add_plugin_content_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
* paypal
|
||||
*
|
||||
*/
|
||||
$admin_post_paypal = PLGNTLS_class::ADMIN_POST_PAYPAL;
|
||||
$nonce_paypal = PLGNTLS_class::ADMIN_MENU_NONCE_PAYPAL;
|
||||
$admin_post_paypal = Plgntls::ADMIN_POST_PAYPAL;
|
||||
$nonce_paypal = Plgntls::ADMIN_MENU_NONCE_PAYPAL;
|
||||
$paypal_credentials = get_paypal_options_CIPF();
|
||||
|
||||
/*
|
||||
* registration email
|
||||
*
|
||||
*/
|
||||
$admin_post_email_registration = PLGNTLS_class::ADMIN_POST_EMAIL_REGISTRATION;
|
||||
$nonce_email = PLGNTLS_class::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
|
||||
$admin_post_email_registration = Plgntls::ADMIN_POST_EMAIL_REGISTRATION;
|
||||
$nonce_email = Plgntls::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
|
||||
$email_registration = get_email_registration_option_CIPF();
|
||||
|
||||
/*
|
||||
* registration email
|
||||
*
|
||||
*/
|
||||
$admin_post_payment_messages = PLGNTLS_class::ADMIN_POST_PAYMENT_MESSAGES;
|
||||
$nonce_payment_messages = PLGNTLS_class::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
|
||||
$admin_post_payment_messages = Plgntls::ADMIN_POST_PAYMENT_MESSAGES;
|
||||
$nonce_payment_messages = Plgntls::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
|
||||
$payment_messages = get_payment_messages_option_CIPF();
|
||||
|
||||
ob_start();
|
||||
include(PLGNTLS_class::root_path() . '/html/menu/cipf_menu.html');
|
||||
include(Plgntls::root_path() . '/html/menu/cipf_menu.html');
|
||||
$html = ob_get_clean();
|
||||
echo $html;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ function add_plugin_content_CIPF() {
|
||||
*
|
||||
*/
|
||||
function redirect_menu_referer_CIPF($post) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
if (!isset($post)) {
|
||||
wp_redirect(admin_url(), 301);
|
||||
exit;
|
||||
|
||||
@@ -22,8 +22,8 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function change_email_registration_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$nonce_email = PLGNTLS_class::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
|
||||
Plgntls::debug_infos();
|
||||
$nonce_email = Plgntls::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
|
||||
|
||||
if (!isset($_POST[$nonce_email['_name']])) {
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
@@ -39,14 +39,14 @@ function change_email_registration_CIPF() {
|
||||
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
}
|
||||
add_action('admin_post_'.PLGNTLS_class::ADMIN_POST_EMAIL_REGISTRATION, 'change_email_registration_CIPF');
|
||||
add_action('admin_post_'.Plgntls::ADMIN_POST_EMAIL_REGISTRATION, 'change_email_registration_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function update_email_registration_option_CIPF($post) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,8 +22,8 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function change_payment_messages_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$nonce_payment_messages = PLGNTLS_class::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
|
||||
Plgntls::debug_infos();
|
||||
$nonce_payment_messages = Plgntls::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
|
||||
|
||||
if (!isset($_POST[$nonce_payment_messages['_name']])) {
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
@@ -39,14 +39,14 @@ function change_payment_messages_CIPF() {
|
||||
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
}
|
||||
add_action('admin_post_'.PLGNTLS_class::ADMIN_POST_PAYMENT_MESSAGES, 'change_payment_messages_CIPF');
|
||||
add_action('admin_post_'.Plgntls::ADMIN_POST_PAYMENT_MESSAGES, 'change_payment_messages_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function update_payment_messages_option_CIPF($post) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
error_log("post: " . json_encode($post));
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function paypal_credentials_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$nonce_paypal = PLGNTLS_class::ADMIN_MENU_NONCE_PAYPAL;
|
||||
Plgntls::debug_infos();
|
||||
$nonce_paypal = Plgntls::ADMIN_MENU_NONCE_PAYPAL;
|
||||
|
||||
if (!isset($_POST[$nonce_paypal['_name']])) {
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
@@ -38,14 +38,14 @@ function paypal_credentials_CIPF() {
|
||||
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
}
|
||||
add_action('admin_post_'.PLGNTLS_class::ADMIN_POST_PAYPAL, 'paypal_credentials_CIPF');
|
||||
add_action('admin_post_'.Plgntls::ADMIN_POST_PAYPAL, 'paypal_credentials_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function update_paypal_credentials_CIPF($post) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,7 +12,7 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
function display_page_css_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$css_for_states = array();
|
||||
|
||||
/*
|
||||
@@ -91,8 +91,7 @@ function display_page_css_CIPF($user_id = null) {
|
||||
$css_for_states[] = 'css/display_states/type_virement.css';
|
||||
}
|
||||
|
||||
$cipf_states = new PLGNTLS_class();
|
||||
$cipf_states->add_to_front($css_for_states);
|
||||
Plgntls::add_to_front($css_for_states);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function send_registration_email_CIPF($send, $user) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
Plgntls::debug_infos();
|
||||
$role_partner = Plgntls::ROLE_PARTNER;
|
||||
$role_prof = Plgntls::ROLE_PROF;
|
||||
|
||||
if (user_can($user, $role_prof)) {
|
||||
$send = is_email_registration_prof_CIPF();
|
||||
@@ -46,7 +46,7 @@ add_filter( 'wp_send_new_user_notification_to_user', 'send_registration_email_CI
|
||||
*
|
||||
*/
|
||||
function filter_regitration_email_CIPF($wp_new_user_notification_email, $user, $blogname) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$wp_new_user_notification_email['message'] = get_email_registration_CIPF();
|
||||
return $wp_new_user_notification_email;
|
||||
}
|
||||
@@ -64,8 +64,8 @@ add_filter('wp_new_user_notification_email', 'filter_regitration_email_CIPF', 21
|
||||
*/
|
||||
|
||||
function set_email_registration_CIPF($email, $is_email_prof, $is_email_partner) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$option_email = PLGNTLS_class::OPTION_EMAIL;
|
||||
Plgntls::debug_infos();
|
||||
$option_email = Plgntls::OPTION_EMAIL;
|
||||
|
||||
$option_data = array();
|
||||
$option_data['email'] = $email;
|
||||
@@ -77,8 +77,8 @@ function set_email_registration_CIPF($email, $is_email_prof, $is_email_partner)
|
||||
|
||||
|
||||
function get_email_registration_option_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$option_email = PLGNTLS_class::OPTION_EMAIL;
|
||||
Plgntls::debug_infos();
|
||||
$option_email = Plgntls::OPTION_EMAIL;
|
||||
|
||||
$email_option_serialized = get_option($option_email['_name']);
|
||||
if (false === $email_option_serialized) {
|
||||
@@ -93,18 +93,18 @@ function get_email_registration_option_CIPF() {
|
||||
|
||||
|
||||
function get_email_registration_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$email_option = get_email_registration_option_CIPF();
|
||||
return $email_option['email'];
|
||||
}
|
||||
|
||||
function is_email_registration_prof_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$email_option = get_email_registration_option_CIPF();
|
||||
return $email_option['is_email_prof'];
|
||||
}
|
||||
function is_email_registration_partner_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$email_option = get_email_registration_option_CIPF();
|
||||
return $email_option['is_email_partner'];
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ if (!defined('ABSPATH')) {
|
||||
* hide admin bar if access a front page and is not an admin
|
||||
*/
|
||||
function hide_admin_bar_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
||||
$role_fipf = PLGNTLS_class::ROLE_FIPF;
|
||||
Plgntls::debug_infos(2);
|
||||
$role_admin = Plgntls::ROLE_ADMIN;
|
||||
$role_fipf = Plgntls::ROLE_FIPF;
|
||||
|
||||
|
||||
/*
|
||||
@@ -27,7 +27,7 @@ function hide_admin_bar_CIPF() {
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
|
||||
/*
|
||||
@@ -53,9 +53,9 @@ add_action('after_setup_theme', 'hide_admin_bar_CIPF');
|
||||
*
|
||||
*/
|
||||
function restrict_admin_access_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
||||
$role_fipf = PLGNTLS_class::ROLE_FIPF;
|
||||
Plgntls::debug_infos(2);
|
||||
$role_admin = Plgntls::ROLE_ADMIN;
|
||||
$role_fipf = Plgntls::ROLE_FIPF;
|
||||
|
||||
/*
|
||||
* this concerns logged_in users, for admin page
|
||||
@@ -67,7 +67,7 @@ function restrict_admin_access_CIPF() {
|
||||
if (!is_admin()) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
* some roles are allowed to access the admin panel
|
||||
|
||||
@@ -23,7 +23,7 @@ if (!defined('ABSPATH')) {
|
||||
* - $menu_redirect = 'www.un_autre_site.net/contact' -> https://www.un_autre_site.net/contact
|
||||
*/
|
||||
function change_menu_logout($items){
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$menu_title = 'special logout';
|
||||
|
||||
// quelques urls utiles :
|
||||
|
||||
@@ -17,8 +17,8 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function partner_page_scripts_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
Plgntls::debug_infos(2);
|
||||
$role_partner = Plgntls::ROLE_PARTNER;
|
||||
|
||||
/*
|
||||
* dont do anything if :
|
||||
@@ -37,7 +37,7 @@ function partner_page_scripts_CIPF() {
|
||||
if (is_null($post)) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$current_post_author = (int)($post->post_author);
|
||||
$current_user_id = (int)get_current_user_id();
|
||||
if ($current_user_id !== $current_post_author) {
|
||||
@@ -48,8 +48,7 @@ function partner_page_scripts_CIPF() {
|
||||
* on partner own page, load css
|
||||
*
|
||||
*/
|
||||
$cipf_partner = new PLGNTLS_class();
|
||||
$cipf_partner->add_to_front(array('css/partner_page.css'));
|
||||
Plgntls::add_to_front(array('css/partner_page.css'));
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'partner_page_scripts_CIPF', 11);
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function add_fields_register_CIPF($args) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
$slug_partner_registration = PLGNTLS_class::SLUG_PARTNER_REGISTRATION;
|
||||
$input_hidden_role = PLGNTLS_class::INPUT_HIDDEN_ROLE;
|
||||
Plgntls::debug_infos();
|
||||
$role_partner = Plgntls::ROLE_PARTNER;
|
||||
$slug_partner_registration = Plgntls::SLUG_PARTNER_REGISTRATION;
|
||||
$input_hidden_role = Plgntls::INPUT_HIDDEN_ROLE;
|
||||
|
||||
/*
|
||||
* compare current slug to partner-register slug
|
||||
@@ -46,9 +46,9 @@ add_action('xoo_el_register_add_fields', 'add_fields_register_CIPF');
|
||||
*
|
||||
*/
|
||||
function add_role_partners_CIPF($customer_data){
|
||||
PLGNTLS_class::debug_infos();
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
$input_hidden_role = PLGNTLS_class::INPUT_HIDDEN_ROLE;
|
||||
Plgntls::debug_infos();
|
||||
$role_partner = Plgntls::ROLE_PARTNER;
|
||||
$input_hidden_role = Plgntls::INPUT_HIDDEN_ROLE;
|
||||
|
||||
/*
|
||||
* check query of form submit
|
||||
|
||||
@@ -12,8 +12,8 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
function set_paypal_options_CIPF($is_sandbox, $client_id, $client_secret) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$option_paypal = PLGNTLS_class::OPTION_PAYPAL;
|
||||
Plgntls::debug_infos();
|
||||
$option_paypal = Plgntls::OPTION_PAYPAL;
|
||||
|
||||
$option_data = array();
|
||||
$option_data['is_sandbox'] = $is_sandbox;
|
||||
@@ -28,8 +28,8 @@ function set_paypal_options_CIPF($is_sandbox, $client_id, $client_secret) {
|
||||
|
||||
|
||||
function get_paypal_options_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$option_paypal = PLGNTLS_class::OPTION_PAYPAL;
|
||||
Plgntls::debug_infos();
|
||||
$option_paypal = Plgntls::OPTION_PAYPAL;
|
||||
|
||||
$paypal_credentials_serialized = get_option($option_paypal['_name']);
|
||||
if (false === $paypal_credentials_serialized) {
|
||||
@@ -46,26 +46,26 @@ function get_paypal_options_CIPF() {
|
||||
|
||||
|
||||
function get_paypal_client_id_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$paypal_credentials = get_paypal_options_CIPF();
|
||||
return $paypal_credentials['client_id'];
|
||||
}
|
||||
function get_paypal_client_secret_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$paypal_credentials = get_paypal_options_CIPF();
|
||||
return $paypal_credentials['client_secret'];
|
||||
}
|
||||
function get_paypal_api_base_url_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$paypal_credentials = get_paypal_options_CIPF();
|
||||
|
||||
$paypal_base_url = '';
|
||||
$is_sandbox = $paypal_credentials['is_sandbox'];
|
||||
if ($is_sandbox) {
|
||||
$paypal_base_url = PLGNTLS_class::PAYPAL_SBOX_API_BASE_URL;
|
||||
$paypal_base_url = Plgntls::PAYPAL_SBOX_API_BASE_URL;
|
||||
}
|
||||
else {
|
||||
$paypal_base_url = PLGNTLS_class::PAYPAL_LIVE_API_BASE_URL;
|
||||
$paypal_base_url = Plgntls::PAYPAL_LIVE_API_BASE_URL;
|
||||
}
|
||||
return $paypal_base_url;
|
||||
}
|
||||
@@ -79,8 +79,8 @@ function get_paypal_api_base_url_CIPF() {
|
||||
*/
|
||||
|
||||
function set_payment_messages_option_CIPF($success, $failure) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$option_payment = PLGNTLS_class::OPTION_PAYMENT;
|
||||
Plgntls::debug_infos();
|
||||
$option_payment = Plgntls::OPTION_PAYMENT;
|
||||
|
||||
$option_data = array();
|
||||
$option_data['success'] = $success;
|
||||
@@ -90,8 +90,8 @@ function set_payment_messages_option_CIPF($success, $failure) {
|
||||
}
|
||||
|
||||
function get_payment_messages_option_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$option_payment = PLGNTLS_class::OPTION_PAYMENT;
|
||||
Plgntls::debug_infos();
|
||||
$option_payment = Plgntls::OPTION_PAYMENT;
|
||||
|
||||
$payment_option_serialized = get_option($option_payment['_name']);
|
||||
if (false === $payment_option_serialized) {
|
||||
@@ -103,13 +103,13 @@ function get_payment_messages_option_CIPF() {
|
||||
}
|
||||
|
||||
function get_payment_message_success_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$payment_option = get_payment_messages_option_CIPF();
|
||||
return $payment_option['success'];
|
||||
}
|
||||
|
||||
function get_payment_message_failure_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$payment_option = get_payment_messages_option_CIPF();
|
||||
return $payment_option['failure'];
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function payment_page_checks_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_paypal_page = Plgntls::SLUG_PAYPAL_PAGE;
|
||||
|
||||
// check the slug
|
||||
if (!is_page($slug_paypal_page)) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
// get the user id
|
||||
$user_id = get_current_user_id();
|
||||
@@ -42,9 +42,9 @@ add_action('wp', 'payment_page_checks_CIPF');
|
||||
*
|
||||
*/
|
||||
function payment_page_redirects_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE;
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_paypal_page = Plgntls::SLUG_PAYPAL_PAGE;
|
||||
$role_prof = Plgntls::ROLE_PROF;
|
||||
|
||||
// don't redirect if it is the divi builder mode
|
||||
if (et_fb_is_enabled()) {
|
||||
@@ -54,7 +54,7 @@ function payment_page_redirects_CIPF() {
|
||||
if (!is_page($slug_paypal_page)) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
* if prof, don't redirect
|
||||
@@ -77,14 +77,14 @@ add_action('template_redirect', 'payment_page_redirects_CIPF');
|
||||
*
|
||||
*/
|
||||
function payment_page_scripts_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_paypal_page = Plgntls::SLUG_PAYPAL_PAGE;
|
||||
|
||||
// check the slug
|
||||
if (!is_page($slug_paypal_page)) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
// get the user id
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
@@ -9,15 +9,15 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
|
||||
include_once(PLGNTLS_class::root_path() . '/php/utils/http_errors.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/route_api_utils.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/user_can_pay.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/update_user_payment.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/shortcode.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/route_api_orders.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/route_api_orders_capture.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/routes.php');
|
||||
include_once(PLGNTLS_class::root_path() . '/php/paypal/payment_page.php');
|
||||
include_once(Plgntls::root_path() . '/php/utils/http_errors.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/route_api_utils.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/user_can_pay.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/update_user_payment.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/shortcode.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/route_api_orders.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/route_api_orders_capture.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/routes.php');
|
||||
include_once(Plgntls::root_path() . '/php/paypal/payment_page.php');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function handle_orders_request_CIPF($request_data) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
// declaring outside the try..catch scope
|
||||
$order_response = array();
|
||||
@@ -90,9 +90,9 @@ function handle_orders_request_CIPF($request_data) {
|
||||
*
|
||||
*/
|
||||
function create_order_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$paypal_api_base_url = get_paypal_api_base_url_CIPF();
|
||||
$acf_card_price_total = PLGNTLS_class::ACF_CARD_PRICE_TOTAL;
|
||||
$acf_card_price_total = Plgntls::ACF_CARD_PRICE_TOTAL;
|
||||
|
||||
$access_token = generate_access_token_CIPF();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
function handle_orders_capture_request_CIPF($request) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$order_id = $request['orderID'];
|
||||
// declaring outside the try..catch scope
|
||||
$response_json = array();
|
||||
@@ -75,7 +75,7 @@ function handle_orders_capture_request_CIPF($request) {
|
||||
* @see https://developer.paypal.com/docs/api/orders/v2/#orders_capture
|
||||
*/
|
||||
function capture_order_CIPF($order_id) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$paypal_api_base_url = get_paypal_api_base_url_CIPF();
|
||||
$access_token = generate_access_token_CIPF();
|
||||
$url = $paypal_api_base_url . '/v2/checkout/orders/' . $order_id . '/capture';
|
||||
|
||||
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function handle_json_response_CIPF($response, $ch) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
if ($response === false)
|
||||
throw new HttpException('cURL error: ' . curl_error($ch), 502);
|
||||
|
||||
@@ -33,7 +33,7 @@ function handle_json_response_CIPF($response, $ch) {
|
||||
);
|
||||
}
|
||||
function handle_response_CIPF($response) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
try
|
||||
{
|
||||
// Decode JSON response
|
||||
@@ -60,7 +60,7 @@ function handle_response_CIPF($response) {
|
||||
* @see https://developer.paypal.com/api/rest/authentication/
|
||||
*/
|
||||
function generate_access_token_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
$paypal_client_id = get_paypal_client_id_CIPF();
|
||||
$paypal_client_secret = get_paypal_client_secret_CIPF();
|
||||
$paypal_api_base_url = get_paypal_api_base_url_CIPF();
|
||||
|
||||
@@ -12,11 +12,11 @@ if (!defined('ABSPATH')) {
|
||||
// handling routes and endpoints
|
||||
// diff routes and endpoints : https://stackoverflow.com/q/56075017/9497573
|
||||
function routes_endpoints_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
$base_rest_route = PLGNTLS_class::URL_BASE_REST_ROUTE;
|
||||
$base_rest_route = Plgntls::URL_BASE_REST_ROUTE;
|
||||
register_rest_route($base_rest_route, '/orders', array(
|
||||
'methods' => 'POST',
|
||||
'callback' => 'handle_orders_request_CIPF',
|
||||
|
||||
@@ -16,16 +16,15 @@ if (!defined('ABSPATH')) {
|
||||
* call to paypal_shortcode_content()
|
||||
*/
|
||||
function paypal_shortcode_content_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$slug_paypal_redirection_success = PLGNTLS_class::SLUG_PAYPAL_REDIRECTION_SUCCESS;
|
||||
$slug_paypal_redirection_failure = PLGNTLS_class::SLUG_PAYPAL_REDIRECTION_FAILURE;
|
||||
Plgntls::debug_infos();
|
||||
$slug_paypal_redirection_success = Plgntls::SLUG_PAYPAL_REDIRECTION_SUCCESS;
|
||||
$slug_paypal_redirection_failure = Plgntls::SLUG_PAYPAL_REDIRECTION_FAILURE;
|
||||
$paypal_client_id = get_paypal_client_id_CIPF();
|
||||
$paypal_message_success = get_payment_message_success_CIPF();
|
||||
$paypal_message_failure = get_payment_message_failure_CIPF();
|
||||
|
||||
// if (!can_pay_now_CIPF())
|
||||
// return no_payment_CIPF();
|
||||
$cipfcard_paypal = new PLGNTLS_class();
|
||||
|
||||
$pp_client_id = $paypal_client_id;
|
||||
$pp_sdk_currency = "EUR";
|
||||
@@ -35,7 +34,7 @@ function paypal_shortcode_content_CIPF() {
|
||||
$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(
|
||||
$added_to_front = Plgntls::add_to_front(
|
||||
array(
|
||||
$pp_sdk_url,
|
||||
array("js/paypal/paypal.js", 'type'=>'module'),
|
||||
@@ -55,7 +54,7 @@ add_shortcode('cipf_paypal_shortcode', 'paypal_shortcode_content_CIPF');
|
||||
|
||||
|
||||
function no_payment_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function update_user_pre_order_CIPF($message) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_payment_status = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
|
||||
$meta_order_id = PLGNTLS_class::META_ORDER_ID;
|
||||
Plgntls::debug_infos();
|
||||
$acf_payment_status = Plgntls::ACF_CARD_PAYMENT_STATE;
|
||||
$meta_order_id = Plgntls::META_ORDER_ID;
|
||||
|
||||
$order_id = $message->id;
|
||||
$user_id = get_current_user_id();
|
||||
@@ -71,7 +71,7 @@ function update_user_pre_order_CIPF($message) {
|
||||
*
|
||||
*/
|
||||
function update_user_post_capture_CIPF($message) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
$order_id = $message->id;
|
||||
$user_id = get_current_user_id();
|
||||
@@ -127,8 +127,8 @@ function update_user_post_capture_CIPF($message) {
|
||||
*
|
||||
*/
|
||||
function failure_payment_for_user_CIPF($user_id, $order_id, $status) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$meta_order_id = PLGNTLS_class::META_ORDER_ID;
|
||||
Plgntls::debug_infos();
|
||||
$meta_order_id = Plgntls::META_ORDER_ID;
|
||||
|
||||
$acf_id = 'user_'.$user_id;
|
||||
|
||||
@@ -149,8 +149,8 @@ function failure_payment_for_user_CIPF($user_id, $order_id, $status) {
|
||||
*
|
||||
*/
|
||||
function success_payment_for_user_CIPF($user_id, $order_id) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$meta_order_id = PLGNTLS_class::META_ORDER_ID;
|
||||
Plgntls::debug_infos();
|
||||
$meta_order_id = Plgntls::META_ORDER_ID;
|
||||
|
||||
$acf_id = 'user_'.$user_id;
|
||||
|
||||
@@ -185,9 +185,9 @@ function success_payment_for_user_CIPF($user_id, $order_id) {
|
||||
*
|
||||
*/
|
||||
function find_user_with_order_id_CIPF($current_user_id, $order_id) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$meta_order_id = PLGNTLS_class::META_ORDER_ID;
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
Plgntls::debug_infos();
|
||||
$meta_order_id = Plgntls::META_ORDER_ID;
|
||||
$role_prof = Plgntls::ROLE_PROF;
|
||||
|
||||
$user_metas = get_user_meta($current_user_id, $meta_order_id, false);
|
||||
if (in_array($order_id, $user_metas)) {
|
||||
|
||||
@@ -42,13 +42,13 @@ function get_acf_value_CIPF($acf_field, $acf_id) {
|
||||
*
|
||||
*/
|
||||
function check_can_pay_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_card_payment_method = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD;
|
||||
$acf_card_price_choice = PLGNTLS_class::ACF_CARD_PRICE_CHOICE;
|
||||
$acf_card_price_delivery = PLGNTLS_class::ACF_CARD_PRICE_DELIVERY;
|
||||
$acf_card_price_total = PLGNTLS_class::ACF_CARD_PRICE_TOTAL;
|
||||
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
|
||||
$card_renew_period = PLGNTLS_class::CARD_RENEW_PERIOD;
|
||||
Plgntls::debug_infos();
|
||||
$acf_card_payment_method = Plgntls::ACF_CARD_PAYMENT_METHOD;
|
||||
$acf_card_price_choice = Plgntls::ACF_CARD_PRICE_CHOICE;
|
||||
$acf_card_price_delivery = Plgntls::ACF_CARD_PRICE_DELIVERY;
|
||||
$acf_card_price_total = Plgntls::ACF_CARD_PRICE_TOTAL;
|
||||
$acf_card_expiration = Plgntls::ACF_CARD_EXPIRATION;
|
||||
$card_renew_period = Plgntls::CARD_RENEW_PERIOD;
|
||||
|
||||
$current_user = wp_get_current_user();
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
@@ -17,8 +17,8 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function get_date_limit_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
|
||||
Plgntls::debug_infos();
|
||||
$acf_card_expiration = Plgntls::ACF_CARD_EXPIRATION;
|
||||
|
||||
/*
|
||||
* define ids
|
||||
@@ -71,7 +71,7 @@ function get_date_limit_CIPF($user_id = null) {
|
||||
*
|
||||
*/
|
||||
function card_date_diff_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
/*
|
||||
* get date limit as DateTime object
|
||||
*
|
||||
@@ -99,7 +99,7 @@ function card_date_diff_CIPF($user_id = null) {
|
||||
*
|
||||
*/
|
||||
function is_card_date_expired_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
* define user_id
|
||||
@@ -131,8 +131,8 @@ function is_card_date_expired_CIPF($user_id = null) {
|
||||
*
|
||||
*/
|
||||
function card_date_exists_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
|
||||
Plgntls::debug_infos();
|
||||
$acf_card_expiration = Plgntls::ACF_CARD_EXPIRATION;
|
||||
|
||||
/*
|
||||
* define ids
|
||||
@@ -168,9 +168,9 @@ function card_date_exists_CIPF($user_id = null) {
|
||||
*
|
||||
*/
|
||||
function update_card_expiration_CIPF($user_id = null) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
|
||||
$card_duration = PLGNTLS_class::CARD_VALIDITY_TIME;
|
||||
Plgntls::debug_infos();
|
||||
$acf_card_expiration = Plgntls::ACF_CARD_EXPIRATION;
|
||||
$card_duration = Plgntls::CARD_VALIDITY_TIME;
|
||||
|
||||
/*
|
||||
* define acf id and acf date format
|
||||
|
||||
@@ -16,9 +16,9 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function prof_after_form_commande_CIPF($form_id, $post_array, $form_type) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
|
||||
$form_prof_commande_id = PLGNTLS_class::FORM_PROF_COMMANDE_ID;
|
||||
Plgntls::debug_infos();
|
||||
$acf_account_state = Plgntls::ACF_ACCOUNT_STATE;
|
||||
$form_prof_commande_id = Plgntls::FORM_PROF_COMMANDE_ID;
|
||||
|
||||
if ($form_prof_commande_id !== $form_id) {
|
||||
return;
|
||||
@@ -75,9 +75,9 @@ add_action('df_after_process', 'prof_after_form_commande_CIPF', 10, 3);
|
||||
*
|
||||
*/
|
||||
function prof_form_restrictions_CIPF(){
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD;
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_command_card = Plgntls::SLUG_COMMAND_CARD;
|
||||
$role_prof = Plgntls::ROLE_PROF;
|
||||
|
||||
// don't redirect if it is the divi builder mode
|
||||
if (et_fb_is_enabled()) {
|
||||
@@ -86,7 +86,7 @@ function prof_form_restrictions_CIPF(){
|
||||
if (!is_page($slug_command_card)) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
* if prof, don't redirect
|
||||
@@ -108,12 +108,12 @@ add_action('template_redirect', 'prof_form_restrictions_CIPF');
|
||||
*
|
||||
*/
|
||||
function renew_page_filter_message_CIPF(){
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_command_card = Plgntls::SLUG_COMMAND_CARD;
|
||||
|
||||
if (!is_page($slug_command_card))
|
||||
return;
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function handle_transfert_validation_CIPF($user_id) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
if (false === is_transfert_success_CIPF($user_id)) {
|
||||
return;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ function handle_transfert_validation_CIPF($user_id) {
|
||||
*
|
||||
*/
|
||||
function handle_card_expire_CIPF($user_id) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
if (false === card_date_exists_CIPF($user_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function prof_after_form_transfert_validation_CIPF($form_id, $post_array, $form_type) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
$acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE;
|
||||
$form_prof_transfert_id = PLGNTLS_class::FORM_PROF_TRANSFERT_ID;
|
||||
Plgntls::debug_infos();
|
||||
$acf_account_state = Plgntls::ACF_ACCOUNT_STATE;
|
||||
$form_prof_transfert_id = Plgntls::FORM_PROF_TRANSFERT_ID;
|
||||
|
||||
if ($form_prof_transfert_id !== $form_id) {
|
||||
return;
|
||||
@@ -41,12 +41,12 @@ add_action('df_after_process', 'prof_after_form_transfert_validation_CIPF', 10,
|
||||
*
|
||||
*/
|
||||
function prof_profil_check_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
Plgntls::debug_infos(2);
|
||||
|
||||
// is an author page
|
||||
if (!is_author())
|
||||
return;
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
// the way to find the id of the author of an author_page
|
||||
$author_id = get_queried_object_id();
|
||||
@@ -64,10 +64,10 @@ add_action('wp', 'prof_profil_check_CIPF', 11);
|
||||
*
|
||||
*/
|
||||
function prof_profil_redirects_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$role_fipf = PLGNTLS_class::ROLE_FIPF;
|
||||
$role_admin = PLGNTLS_class::ROLE_ADMIN;
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
Plgntls::debug_infos(2);
|
||||
$role_fipf = Plgntls::ROLE_FIPF;
|
||||
$role_admin = Plgntls::ROLE_ADMIN;
|
||||
$role_partner = Plgntls::ROLE_PARTNER;
|
||||
|
||||
// is an author page
|
||||
if (!is_author())
|
||||
@@ -76,7 +76,7 @@ function prof_profil_redirects_CIPF() {
|
||||
if (et_fb_is_enabled()) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
|
||||
/*
|
||||
@@ -130,12 +130,12 @@ add_action('template_redirect', 'prof_profil_redirects_CIPF', 11);
|
||||
*
|
||||
*/
|
||||
function prof_profil_scripts_CIPF() {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
Plgntls::debug_infos(2);
|
||||
|
||||
// is an author page
|
||||
if (!is_author())
|
||||
return;
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
// the way to find the id of the author of an author_page
|
||||
$author_id = get_queried_object_id();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -18,7 +18,7 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function randomize_post_output_CIPF($query) {
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
Plgntls::debug_infos(2);
|
||||
$posts_per_page = $query->get('posts_per_page');
|
||||
if (is_null($posts_per_page)) {
|
||||
return;
|
||||
@@ -26,7 +26,7 @@ function randomize_post_output_CIPF($query) {
|
||||
if ($posts_per_page >= -1) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
error_log("posts_per_page: " . json_encode($posts_per_page));
|
||||
$query->set('orderby', 'rand');
|
||||
|
||||
@@ -15,7 +15,7 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
function redirect_home_CIPF(){
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
// Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes
|
||||
nocache_headers();
|
||||
@@ -32,8 +32,8 @@ function redirect_home_CIPF(){
|
||||
*
|
||||
*/
|
||||
function redirect_command_CIPF(){
|
||||
PLGNTLS_class::debug_infos();
|
||||
$slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD;
|
||||
Plgntls::debug_infos();
|
||||
$slug_command_card = Plgntls::SLUG_COMMAND_CARD;
|
||||
|
||||
// Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes
|
||||
nocache_headers();
|
||||
@@ -52,10 +52,10 @@ function redirect_command_CIPF(){
|
||||
*
|
||||
*/
|
||||
function redirection_profil_CIPF(){
|
||||
PLGNTLS_class::debug_infos();
|
||||
$role_prof = PLGNTLS_class::ROLE_PROF;
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
$slug_partner_create_page = PLGNTLS_class::SLUG_PARTNER_CREATE_PAGE;
|
||||
Plgntls::debug_infos();
|
||||
$role_prof = Plgntls::ROLE_PROF;
|
||||
$role_partner = Plgntls::ROLE_PARTNER;
|
||||
$slug_partner_create_page = Plgntls::SLUG_PARTNER_CREATE_PAGE;
|
||||
|
||||
$partner_page_creation = home_url($slug_partner_create_page);
|
||||
$current_user_id = get_current_user_id();
|
||||
@@ -122,8 +122,8 @@ error_log("is prof");
|
||||
*
|
||||
*/
|
||||
function redirection_page_CIPF(){
|
||||
PLGNTLS_class::debug_infos(2);
|
||||
$slug_page_redirection = PLGNTLS_class::SLUG_PAGE_REDIRECTION;
|
||||
Plgntls::debug_infos(2);
|
||||
$slug_page_redirection = Plgntls::SLUG_PAGE_REDIRECTION;
|
||||
|
||||
|
||||
/*
|
||||
@@ -139,7 +139,7 @@ function redirection_page_CIPF(){
|
||||
if ($current_slug !== $slug_page_redirection) {
|
||||
return;
|
||||
}
|
||||
PLGNTLS_class::debug_infos();
|
||||
Plgntls::debug_infos();
|
||||
|
||||
redirection_profil_CIPF();
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
//function schedule_delete_orderid_CIPF($user_id, $order_id) {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// Plgntls::debug_infos();
|
||||
// $delay = time() + MINUTE_IN_SECONDS;
|
||||
// wp_schedule_single_event($delay, 'orderid_deletion_event_CIPF', array($user_id, $order_id));
|
||||
//}
|
||||
//function delete_order_id_later_CIPF($user_id, $order_id) {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// Plgntls::debug_infos();
|
||||
// delete_user_meta($user_id, 'cipf_order_id', $order_id);
|
||||
//}
|
||||
//add_action('orderid_deletion_event_CIPF', 'delete_order_id_later_CIPF', 5, 2);
|
||||
|
||||
27
plugins/cipf_plugin/php/utils/console_log.php
Normal file
27
plugins/cipf_plugin/php/utils/console_log.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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!');
|
||||
}
|
||||
|
||||
/*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
https://stackify.com/how-to-log-to-console-in-php/
|
||||
*/
|
||||
function console_log(...$outputs) {
|
||||
Plgntls::debug_infos();
|
||||
if (CIPF_CONSOLE_OFF)
|
||||
return;
|
||||
foreach($outputs as $output)
|
||||
{
|
||||
$json_output = json_encode($output, JSON_HEX_TAG);
|
||||
$js_code = '<script>console.log(' . $json_output . ');</script>';
|
||||
echo $js_code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user