201 lines
12 KiB
PHP
201 lines
12 KiB
PHP
<?php
|
|
/*
|
|
Plugin Name: fipfcard_plugin
|
|
Plugin URI:
|
|
Description:
|
|
Author: hugogogo
|
|
Version: 1.1.0
|
|
Author URI:
|
|
*/
|
|
|
|
/*
|
|
* it means someone outside wp is accessing the file, in this case kill it.
|
|
*/
|
|
if (!defined('ABSPATH')) {
|
|
die('You can not access this file!');
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
* plugin dir root
|
|
*/
|
|
include_once( plugin_dir_path(__FILE__) . '/utils/plgntls_class.php');
|
|
PLGNTLS_class::set_root_dir( plugin_dir_path(__FILE__), plugin_dir_url(__FILE__) );
|
|
|
|
|
|
|
|
|
|
/*
|
|
* general inclusions
|
|
*/
|
|
include_once(PLGNTLS_class::get_path() . 'php/utils/globals.php');
|
|
|
|
include_once(PLGNTLS_class::get_path() . 'utils/console_log.php');
|
|
|
|
include_once(PLGNTLS_class::get_path() . 'php/admin_menu/example_menu.php');
|
|
|
|
include_once(PLGNTLS_class::get_path() . 'php/paypal/paypal.php');
|
|
|
|
include_once(PLGNTLS_class::get_path() . '/php/user_infos.php');
|
|
include_once(PLGNTLS_class::get_path() . '/php/hide_admin.php');
|
|
//include_once(PLGNTLS_class::get_path() . '/php/menus.php');
|
|
include_once(PLGNTLS_class::get_path() . 'php/register_partenaires.php');
|
|
include_once(PLGNTLS_class::get_path() . 'php/redirections.php');
|
|
include_once(PLGNTLS_class::get_path() . 'php/author_restriction.php');
|
|
include_once(PLGNTLS_class::get_path() . 'php/reset_acf_fields.php');
|
|
|
|
//include_once(PLGNTLS_class::get_path() . 'php/form_builder_patch/url_validation.php');
|
|
include_once(PLGNTLS_class::get_path() . 'php/form_builder_patch/multiple_modals.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* old version
|
|
* callback for filter_email_CIPF, that does not receive the user id
|
|
*/
|
|
function replace_words_CIPF($matches) {
|
|
$current_user = wp_get_current_user();
|
|
$query = $matches[1];
|
|
$result = $current_user->$query;
|
|
return $result;
|
|
}
|
|
|
|
function filter_email_CIPF($reply_body, $post_array) {
|
|
$id = $post_array['ID'];
|
|
error_log("---");
|
|
// pattern : anything surrounded by '$$', ex : $$value$$
|
|
$pattern = '/\$\$(.*?)\$\$/';
|
|
|
|
// old version, using an outside callback, better readibility but cannot pass $id
|
|
//$new_body = preg_replace_callback($pattern, 'replace_words_CIPF', $reply_body);
|
|
|
|
// inline callback, with 'use' to get the id
|
|
$new_body = preg_replace_callback($pattern, function($matches) use ($id) {
|
|
$current_user = get_user_by('id', $id);
|
|
$query = $matches[1];
|
|
$result = $current_user->$query;
|
|
return $result;
|
|
}, $reply_body);
|
|
|
|
error_log("new_body");
|
|
error_log($new_body);
|
|
|
|
return $new_body;
|
|
}
|
|
add_filter('df_confirmation_body', 'filter_email_CIPF', 10, 2);
|
|
|
|
/*
|
|
|
|
// Define your key-value pairs
|
|
$replacements = [
|
|
'name' => 'John',
|
|
'value' => '100',
|
|
];
|
|
|
|
// Define a regular expression to match $$keywords$$
|
|
|
|
// Define a callback function to replace the keywords with values
|
|
$replacement_function = function ($matches) use ($replacements) {
|
|
// $matches[1] contains the keyword without the $$ signs
|
|
$keyword = $matches[1];
|
|
// If the keyword exists in the replacements array, return its value
|
|
// Otherwise, return the original keyword (without the $$ signs)
|
|
return isset($replacements[$keyword]) ? $replacements[$keyword] : $matches[0];
|
|
};
|
|
|
|
// Replace the keywords using preg_replace_callback()
|
|
$new_string = preg_replace_callback($pattern, $replacement_function, $string);
|
|
|
|
// Output the new string
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
priority : 1
|
|
"Merci pour votre inscription."
|
|
{"ID":"24","user_login":"Hugogogo","user_pass":"$P$B1KLMir9WeEwvjmgJhQsT0o5ifXMUb.","user_nicename":"hugogogo","user_email":"hugogogo@protonmail.com","user_url":"","user_registered":"2024-02-19 10:55:38","user_activation_key":"","user_status":"0","display_name":"Hugogogo","field_title":["Pr\u00e9nom","Nom","Adresse","Adresse (compl\u00e9ment)","Code postal","Ville","Pays","T\u00e9l\u00e9phone","Adresse email","Fonction","\u00c9tablissement","Niveau d\u2019enseignement","10 ou 15 \u20ac ?","Nom de votre association","Pr\u00e9nom et nom du pr\u00e9sident","Adresse email de l\\'association pour la validation de votre statut","Obs","Photo d\\'identit\u00e9 pour la carte","Justificatif (ex : la copie de votre carte de travail)","Livraison","Moyen de paiement","Conditions g\u00e9n\u00e9rales de vente","Co\u00fbt"],"first_name":"Hugo","last_name":"lamy","user_meta":["de_fb_adresse_1","de_fb_adresse_2","de_fb_code_postal","de_fb_ville","de_fb_pays","de_fb_telephone","de_fb_fonction","de_fb_etablissement","de_fb_niveau_denseignement","de_fb_tarif","de_fb_nom_asso","de_fb_president_asso","de_fb_email_asso","de_fb_observations","de_fb_photo_du_profil","de_fb_justificatif","de_fb_livraison","de_fb_paiement","de_fb_cgv","de_fb_somme_a_regler"],"adresse_2":"","telephone":"","tarif_calc_value":"15","observations":"","livraison_calc_value":"0","somme_a_regler":""}
|
|
|
|
priority : 10
|
|
"Merci pour votre inscription."
|
|
{"ID":"24","user_login":"Hugogogo","user_pass":"$P$B1KLMir9WeEwvjmgJhQsT0o5ifXMUb.","user_nicename":"hugogogo","user_email":"hugogogo@protonmail.com","user_url":"","user_registered":"2024-02-19 10:55:38","user_activation_key":"","user_status":"0","display_name":"Hugogogo","field_title":["Pr\u00e9nom","Nom","Adresse","Adresse (compl\u00e9ment)","Code postal","Ville","Pays","T\u00e9l\u00e9phone","Adresse email","Fonction","\u00c9tablissement","Niveau d\u2019enseignement","10 ou 15 \u20ac ?","Nom de votre association","Pr\u00e9nom et nom du pr\u00e9sident","Adresse email de l\\'association pour la validation de votre statut","Obs","Photo d\\'identit\u00e9 pour la carte","Justificatif (ex : la copie de votre carte de travail)","Livraison","Moyen de paiement","Conditions g\u00e9n\u00e9rales de vente","Co\u00fbt"],"first_name":"Hugo","last_name":"lamy","user_meta":["de_fb_adresse_1","de_fb_adresse_2","de_fb_code_postal","de_fb_ville","de_fb_pays","de_fb_telephone","de_fb_fonction","de_fb_etablissement","de_fb_niveau_denseignement","de_fb_tarif","de_fb_nom_asso","de_fb_president_asso","de_fb_email_asso","de_fb_observations","de_fb_photo_du_profil","de_fb_justificatif","de_fb_livraison","de_fb_paiement","de_fb_cgv","de_fb_somme_a_regler"],"adresse_2":"","telephone":"","tarif_calc_value":"15","observations":"","livraison_calc_value":"0","somme_a_regler":""}
|
|
|
|
priority : 20
|
|
"Merci pour votre inscription."
|
|
{"ID":"24","user_login":"Hugogogo","user_pass":"$P$B1KLMir9WeEwvjmgJhQsT0o5ifXMUb.","user_nicename":"hugogogo","user_email":"hugogogo@protonmail.com","user_url":"","user_registered":"2024-02-19 10:55:38","user_activation_key":"","user_status":"0","display_name":"Hugogogo","field_title":["Pr\u00e9nom","Nom","Adresse","Adresse (compl\u00e9ment)","Code postal","Ville","Pays","T\u00e9l\u00e9phone","Adresse email","Fonction","\u00c9tablissement","Niveau d\u2019enseignement","10 ou 15 \u20ac ?","Nom de votre association","Pr\u00e9nom et nom du pr\u00e9sident","Adresse email de l\\'association pour la validation de votre statut","Obs","Photo d\\'identit\u00e9 pour la carte","Justificatif (ex : la copie de votre carte de travail)","Livraison","Moyen de paiement","Conditions g\u00e9n\u00e9rales de vente","Co\u00fbt"],"first_name":"Hugo","last_name":"lamy","user_meta":["de_fb_adresse_1","de_fb_adresse_2","de_fb_code_postal","de_fb_ville","de_fb_pays","de_fb_telephone","de_fb_fonction","de_fb_etablissement","de_fb_niveau_denseignement","de_fb_tarif","de_fb_nom_asso","de_fb_president_asso","de_fb_email_asso","de_fb_observations","de_fb_photo_du_profil","de_fb_justificatif","de_fb_livraison","de_fb_paiement","de_fb_cgv","de_fb_somme_a_regler"],"adresse_2":"","telephone":"","tarif_calc_value":"15","observations":"","livraison_calc_value":"0","somme_a_regler":""}
|
|
|
|
priority : 999
|
|
"Merci pour votre inscription."
|
|
{"ID":"24","user_login":"Hugogogo","user_pass":"$P$B1KLMir9WeEwvjmgJhQsT0o5ifXMUb.","user_nicename":"hugogogo","user_email":"hugogogo@protonmail.com","user_url":"","user_registered":"2024-02-19 10:55:38","user_activation_key":"","user_status":"0","display_name":"Hugogogo","field_title":["Pr\u00e9nom","Nom","Adresse","Adresse (compl\u00e9ment)","Code postal","Ville","Pays","T\u00e9l\u00e9phone","Adresse email","Fonction","\u00c9tablissement","Niveau d\u2019enseignement","10 ou 15 \u20ac ?","Nom de votre association","Pr\u00e9nom et nom du pr\u00e9sident","Adresse email de l\\'association pour la validation de votre statut","Obs","Photo d\\'identit\u00e9 pour la carte","Justificatif (ex : la copie de votre carte de travail)","Livraison","Moyen de paiement","Conditions g\u00e9n\u00e9rales de vente","Co\u00fbt"],"first_name":"Hugo","last_name":"lamy","user_meta":["de_fb_adresse_1","de_fb_adresse_2","de_fb_code_postal","de_fb_ville","de_fb_pays","de_fb_telephone","de_fb_fonction","de_fb_etablissement","de_fb_niveau_denseignement","de_fb_tarif","de_fb_nom_asso","de_fb_president_asso","de_fb_email_asso","de_fb_observations","de_fb_photo_du_profil","de_fb_justificatif","de_fb_livraison","de_fb_paiement","de_fb_cgv","de_fb_somme_a_regler"],"adresse_2":"","telephone":"","tarif_calc_value":"15","observations":"","livraison_calc_value":"0","somme_a_regler":""}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
add_filter( 'df_confirmation_body', 'filter_email_CIPF', 1); // 8-9-10-11 : body email to prof
|
|
add_filter( 'df_confirmation_body', 'filter_email_CIPF', 1); // 8-9-10-11 : body email to prof
|
|
add_filter( 'df_notification_body', 'filter_email_CIPF', 1); // 1 : body email to diego
|
|
add_filter( 'df_notifcation_recipient', 'filter_email_CIPF', 1); // 2 : email to: (to diego)
|
|
*/
|
|
|
|
/*
|
|
used :
|
|
|
|
add_filter( 'df_confirmation_body', 'filter_email_CIPF', 1); // 8-9-10-11
|
|
- "Merci pour votre inscription."
|
|
add_filter( 'df_confirmation_body', 'filter_email_CIPF', 1); // 8-9-10-11
|
|
- "Merci pour votre inscription."
|
|
add_filter( 'df_confirmation_body', 'filter_email_CIPF', 1); // 8-9-10-11
|
|
- "Merci pour votre inscription."
|
|
add_filter( 'df_notifcation_recipient', 'filter_email_CIPF', 1); // 2
|
|
- "testi_le_testeur@proton.me"
|
|
add_filter( 'df_notification_body', 'filter_email_CIPF', 1); // 1
|
|
- "Commande \u00e0 v\u00e9rifier sur le site :lamy, Hugo a command\u00e9 sa carte."
|
|
|
|
|
|
not used :
|
|
add_filter( 'df_contact_recipient', 'filter_email_CIPF', 1); // 6-7
|
|
add_filter( 'df_contact_recipient', 'filter_email_CIPF', 1); // 6-7
|
|
add_filter( 'df_contact_body', 'filter_email_CIPF', 1); // 4-5
|
|
add_filter( 'df_contact_body', 'filter_email_CIPF', 1); // 4-5
|
|
add_filter( 'wpml_translate_single_string', 'filter_email_CIPF', 1); // 3
|
|
add_filter('df_contact_body', 'filter_email_CIPF', 1); // 0
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
1 $body = apply_filters( 'df_notification_body', $body, $post_array );
|
|
2 $email = apply_filters( 'df_notifcation_recipient', $email, $form_id, $post_array );
|
|
3 $title = apply_filters( 'wpml_translate_single_string', $title_get, 'divi-form-builder', 'Edit Post Button Title Text' );
|
|
|
|
4 $body = apply_filters( 'df_contact_body', $body, $post_array );
|
|
5 $body = apply_filters( 'df_contact_body', $body, $post_array );
|
|
|
|
6 $email = apply_filters( 'df_contact_recipient', $email, $form_id, $post_array );
|
|
7 $email = apply_filters( 'df_contact_recipient', $email, $form_id, $processed_post_array );
|
|
|
|
8 $reply_body = apply_filters( 'df_confirmation_body', $reply_body, $post_array );
|
|
9 $reply_body = apply_filters( 'df_confirmation_body', $reply_body, $post_array );
|
|
10 $reply_body = apply_filters( 'df_confirmation_body', $reply_body, $post_array );
|
|
11 $reply_body = apply_filters( 'df_confirmation_body', $reply_body, $post_array );
|
|
|
|
12 $message_content = apply_filters( 'the_content', get_post_field( 'post_content', $message_array['layout'] ) );
|
|
13 $content = apply_filters( 'the_content', get_post_field( 'post_content', $message_array['layout'] ) );
|
|
14 $content = apply_filters( 'the_content', get_post_field('post_content', $html_content_divi_layout));
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
?>
|