wip adding fbpatch plugin
This commit is contained in:
@@ -43,7 +43,6 @@ include_once(PLGNTLS_class::root_path() . 'php/profs_states.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/profs_handle_states.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/partners_register.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/partners_page.php');
|
||||
//include_once(PLGNTLS_class::root_path() . 'php/partners_form.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/display_css.php');
|
||||
|
||||
|
||||
@@ -51,8 +50,9 @@ include_once(PLGNTLS_class::root_path() . 'php/display_css.php');
|
||||
/*
|
||||
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/url_validation.php');
|
||||
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/multiple_modals.php');
|
||||
*/
|
||||
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/form_calculation.php');
|
||||
*/
|
||||
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/hide_show_elements.php');
|
||||
|
||||
|
||||
|
||||
|
||||
1
plugins/cipf_plugin/css/hide_show_form_elements.css
Normal file
1
plugins/cipf_plugin/css/hide_show_form_elements.css
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,489 @@
|
||||
<?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!');
|
||||
}
|
||||
|
||||
/*
|
||||
* 4674 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/modules/Form/Form.php
|
||||
*
|
||||
*/
|
||||
function form_partner_before_render_CIPF() {
|
||||
PLGNTLS_class::debug_infos();
|
||||
|
||||
$cipf_form_partner = new PLGNTLS_class();
|
||||
$cipf_form_partner->add_to_front(array(
|
||||
'css/hide_show_form_elements.css',
|
||||
));
|
||||
}
|
||||
add_action('de_fb_before_form_render', 'form_partner_before_render_CIPF');
|
||||
|
||||
|
||||
/*
|
||||
* 305 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
*
|
||||
*/
|
||||
function form_partner_before_process_CIPF($form_id, $post_array, $form_type) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
error_log("form_id: " . json_encode($form_id));
|
||||
error_log("post_array: " . json_encode($post_array));
|
||||
error_log("form_type: " . json_encode($form_type));
|
||||
}
|
||||
add_action('df_before_process', 'form_partner_before_process_CIPF', 10, 3);
|
||||
|
||||
/*
|
||||
* 506 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
*
|
||||
*/
|
||||
function form_partner_before_insert_CIPF($form_id, $post_array) {
|
||||
PLGNTLS_class::debug_infos();
|
||||
error_log("form_id: " . json_encode($form_id));
|
||||
error_log("post_array: " . json_encode($post_array));
|
||||
}
|
||||
add_action('df_before_insert_post', 'form_partner_before_insert_CIPF', 10, 2);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
image 1 afficher :
|
||||
{"ID":36483,"key":"field_65d8bc5d5bf8b","label":"Offre 1 image","name":"offre_1_image","aria-label":"","prefix":"acf","type":"image","value":{"ID":41587,"id":41587,"title":"unnamed-26.jpg","filename":"unnamed-26.jpg","filesize":573797,"url":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","link":"https:\/\/local-cipf-plugin.com\/unnamed-26-jpg\/","alt":"","author":"24","description":"","caption":"","name":"unnamed-26-jpg","status":"inherit","uploaded_to":0,"date":"2024-03-22 22:03:50","modified":"2024-03-22 22:03:50","menu_order":0,"mime_type":"image\/jpeg","type":"image","subtype":"jpeg","icon":"https:\/\/local-cipf-plugin.com\/wp-includes\/images\/media\/default.png","width":1500,"height":600,"sizes":{"thumbnail":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-150x150.jpg","thumbnail-width":150,"thumbnail-height":150,"medium":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-300x120.jpg","medium-width":300,"medium-height":120,"medium_large":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-768x307.jpg","medium_large-width":768,"medium_large-height":307,"large":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1024x410.jpg","large-width":1024,"large-height":410,"1536x1536":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","1536x1536-width":1500,"1536x1536-height":600,"2048x2048":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","2048x2048-width":1500,"2048x2048-height":600,"et-pb-post-main-image":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-400x250.jpg","et-pb-post-main-image-width":400,"et-pb-post-main-image-height":250,"et-pb-post-main-image-fullwidth":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1080x600.jpg","et-pb-post-main-image-fullwidth-width":1080,"et-pb-post-main-image-fullwidth-height":600,"et-pb-portfolio-image":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-400x284.jpg","et-pb-portfolio-image-width":400,"et-pb-portfolio-image-height":284,"et-pb-portfolio-module-image":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-510x382.jpg","et-pb-portfolio-module-image-width":510,"et-pb-portfolio-module-image-height":382,"et-pb-portfolio-image-single":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1080x432.jpg","et-pb-portfolio-image-single-width":1080,"et-pb-portfolio-image-single-height":432,"et-pb-gallery-module-image-portrait":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-400x516.jpg","et-pb-gallery-module-image-portrait-width":400,"et-pb-gallery-module-image-portrait-height":516,"et-pb-post-main-image-fullwidth-large":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","et-pb-post-main-image-fullwidth-large-width":1500,"et-pb-post-main-image-fullwidth-large-height":600,"et-pb-image--responsive--desktop":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1280x512.jpg","et-pb-image--responsive--desktop-width":1280,"et-pb-image--responsive--desktop-height":512,"et-pb-image--responsive--tablet":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-980x392.jpg","et-pb-image--responsive--tablet-width":980,"et-pb-image--responsive--tablet-height":392,"et-pb-image--responsive--phone":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-480x192.jpg","et-pb-image--responsive--phone-width":480,"et-pb-image--responsive--phone-height":192}},"menu_order":5,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":36473,"wrapper":{"width":"","class":"","id":""},"return_format":"array","library":"all","min_width":"","min_height":"","min_size":"","max_width":"","max_height":"","max_size":"","mime_types":"","preview_size":"medium","_name":"offre_1_image","_valid":1}
|
||||
image 1 masquer :
|
||||
{"ID":36483,"key":"field_65d8bc5d5bf8b","label":"Offre 1 image","name":"offre_1_image","aria-label":"","prefix":"acf","type":"image","value":{"ID":41587,"id":41587,"title":"unnamed-26.jpg","filename":"unnamed-26.jpg","filesize":573797,"url":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","link":"https:\/\/local-cipf-plugin.com\/unnamed-26-jpg\/","alt":"","author":"24","description":"","caption":"","name":"unnamed-26-jpg","status":"inherit","uploaded_to":0,"date":"2024-03-22 22:03:50","modified":"2024-03-22 22:03:50","menu_order":0,"mime_type":"image\/jpeg","type":"image","subtype":"jpeg","icon":"https:\/\/local-cipf-plugin.com\/wp-includes\/images\/media\/default.png","width":1500,"height":600,"sizes":{"thumbnail":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-150x150.jpg","thumbnail-width":150,"thumbnail-height":150,"medium":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-300x120.jpg","medium-width":300,"medium-height":120,"medium_large":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-768x307.jpg","medium_large-width":768,"medium_large-height":307,"large":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1024x410.jpg","large-width":1024,"large-height":410,"1536x1536":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","1536x1536-width":1500,"1536x1536-height":600,"2048x2048":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","2048x2048-width":1500,"2048x2048-height":600,"et-pb-post-main-image":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-400x250.jpg","et-pb-post-main-image-width":400,"et-pb-post-main-image-height":250,"et-pb-post-main-image-fullwidth":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1080x600.jpg","et-pb-post-main-image-fullwidth-width":1080,"et-pb-post-main-image-fullwidth-height":600,"et-pb-portfolio-image":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-400x284.jpg","et-pb-portfolio-image-width":400,"et-pb-portfolio-image-height":284,"et-pb-portfolio-module-image":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-510x382.jpg","et-pb-portfolio-module-image-width":510,"et-pb-portfolio-module-image-height":382,"et-pb-portfolio-image-single":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1080x432.jpg","et-pb-portfolio-image-single-width":1080,"et-pb-portfolio-image-single-height":432,"et-pb-gallery-module-image-portrait":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-400x516.jpg","et-pb-gallery-module-image-portrait-width":400,"et-pb-gallery-module-image-portrait-height":516,"et-pb-post-main-image-fullwidth-large":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26.jpg","et-pb-post-main-image-fullwidth-large-width":1500,"et-pb-post-main-image-fullwidth-large-height":600,"et-pb-image--responsive--desktop":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-1280x512.jpg","et-pb-image--responsive--desktop-width":1280,"et-pb-image--responsive--desktop-height":512,"et-pb-image--responsive--tablet":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-980x392.jpg","et-pb-image--responsive--tablet-width":980,"et-pb-image--responsive--tablet-height":392,"et-pb-image--responsive--phone":"https:\/\/local-cipf-plugin.com\/wp-content\/uploads\/de_fb_uploads\/unnamed-26-480x192.jpg","et-pb-image--responsive--phone-width":480,"et-pb-image--responsive--phone-height":192}},"menu_order":5,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":36473,"wrapper":{"width":"","class":"","id":""},"return_format":"array","library":"all","min_width":"","min_height":"","min_size":"","max_width":"","max_height":"","max_size":"","mime_types":"","preview_size":"medium","_name":"offre_1_image","_valid":1}
|
||||
|
||||
|
||||
offre 1 'afficher' :
|
||||
---
|
||||
- BEFORE PROCESS :
|
||||
form_id: "crea_partenaire"
|
||||
post_array: {
|
||||
"post_status":"publish",
|
||||
"field_title":[
|
||||
"Nom commercial",
|
||||
"Votre site Internet",
|
||||
"Dans quelle rubrique devez-vous para\u00eetre ? ",
|
||||
"L\\'accroche en t\u00eate de page",
|
||||
"Pr\u00e9sentez-vous",
|
||||
"Votre logo ",
|
||||
"Image principale",
|
||||
"Voulez-vous afficher cette offre 1 ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"slug"
|
||||
],
|
||||
"post_title":"test_hugo",
|
||||
"meta_input":[
|
||||
"de_fb_url_partenaire",
|
||||
"de_fb_logo_partenaire",
|
||||
"de_fb_afficher_offre_1",
|
||||
"de_fb_duree_offre_1",
|
||||
"de_fb_fin_offre_1",
|
||||
"de_fb_offre_1_titre",
|
||||
"de_fb_offre_1_txt",
|
||||
"de_fb_offre_1_image",
|
||||
"de_fb_afficher_offre_2",
|
||||
"de_fb_duree_offre_2",
|
||||
"de_fb_fin_offre_2",
|
||||
"de_fb_offre_2_titre",
|
||||
"de_fb_offre_2_txt",
|
||||
"de_fb_offre_2_image",
|
||||
"de_fb_afficher_offre_3",
|
||||
"de_fb_duree_offre_3",
|
||||
"de_fb_fin_offre_3",
|
||||
"de_fb_offre_3_titre",
|
||||
"de_fb_offre_3_txt",
|
||||
"de_fb_offre_3_image"
|
||||
],
|
||||
"url_partenaire":"",
|
||||
"tax_input":[
|
||||
"de_fb_category"
|
||||
],
|
||||
"category":"autres",
|
||||
"post_excerpt":"accroche",
|
||||
"post_content":"presentation",
|
||||
"_ajax_linking_nonce":"afc8cd8c69",
|
||||
"logo_partenaire":"41585",
|
||||
"post_thumbnail":"41584",
|
||||
"afficher_offre_1":"Afficher",
|
||||
"duree_offre_1":"Permanente",
|
||||
"offre_1_titre":"titre 1",
|
||||
"offre_1_txt":"offre 1",
|
||||
"offre_1_image":"41587",
|
||||
"afficher_offre_2":"Afficher",
|
||||
"duree_offre_2":"Permanente",
|
||||
"offre_2_titre":"titre 2",
|
||||
"offre_2_txt":"offre 2",
|
||||
"offre_2_image":"41588",
|
||||
"afficher_offre_3":"Afficher",
|
||||
"duree_offre_3":"Permanente",
|
||||
"offre_3_titre":"titre 3",
|
||||
"offre_3_txt":"offre 3",
|
||||
"offre_3_image":"41589",
|
||||
"post_name":"test_hugo",
|
||||
"ID":"41586",
|
||||
"form_type_confirm":""
|
||||
}
|
||||
- BEFORE INSERT :
|
||||
form_type: "post"
|
||||
form_id: "crea_partenaire"
|
||||
post_array: {
|
||||
"post_status":"publish",
|
||||
"field_title":[
|
||||
"Nom commercial",
|
||||
"Votre site Internet",
|
||||
"Dans quelle rubrique devez-vous para\u00eetre ? ",
|
||||
"L\\'accroche en t\u00eate de page",
|
||||
"Pr\u00e9sentez-vous",
|
||||
"Votre logo ",
|
||||
"Image principale",
|
||||
"Voulez-vous afficher cette offre 1 ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre","Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"slug"
|
||||
],
|
||||
"post_title":"test_hugo",
|
||||
"meta_input":{
|
||||
"url_partenaire":"",
|
||||
"_url_partenaire":"field_65cb83096d020",
|
||||
"logo_partenaire":"41585",
|
||||
"_logo_partenaire":"field_65cb79150ac4f",
|
||||
"afficher_offre_1":"Afficher",
|
||||
"_afficher_offre_1":"field_65d8cf09395a5",
|
||||
"duree_offre_1":"Permanente",
|
||||
"_duree_offre_1":"field_65f81843cc36e",
|
||||
"fin_offre_1":[],
|
||||
"offre_1_titre":"titre 1",
|
||||
"_offre_1_titre":"field_65d8bbf6b4651",
|
||||
"offre_1_txt":"offre 1",
|
||||
"_offre_1_txt":"field_65d8bc395bf88",
|
||||
"offre_1_image":"41587",
|
||||
"_offre_1_image":"field_65d8bc5d5bf8b",
|
||||
"afficher_offre_2":"Afficher",
|
||||
"_afficher_offre_2":"field_65e20fb8785ba",
|
||||
"duree_offre_2":"Permanente",
|
||||
"_duree_offre_2":"field_65f3fc577fec4",
|
||||
"fin_offre_2":[],
|
||||
"offre_2_titre":"titre 2",
|
||||
"_offre_2_titre":"field_65d8bc201740b",
|
||||
"offre_2_txt":"offre 2",
|
||||
"_offre_2_txt":"field_65d8bc4c5bf89",
|
||||
"offre_2_image":"41588",
|
||||
"_offre_2_image":"field_65d8bc6e5bf8c",
|
||||
"afficher_offre_3":"Afficher",
|
||||
"_afficher_offre_3":"field_65d8cf48395a6",
|
||||
"duree_offre_3":"Permanente",
|
||||
"_duree_offre_3":"field_65f3ff78c7ffd",
|
||||
"fin_offre_3":[],
|
||||
"offre_3_titre":"titre 3",
|
||||
"_offre_3_titre":"field_65d8bc2e644ab",
|
||||
"offre_3_txt":"offre 3",
|
||||
"_offre_3_txt":"field_65d8bc545bf8a",
|
||||
"offre_3_image":"41589",
|
||||
"_offre_3_image":"field_65d8bc8c5bf8e"
|
||||
},
|
||||
"tax_input":{"category":[1]},
|
||||
"post_excerpt":"accroche",
|
||||
"post_content":"presentation",
|
||||
"_ajax_linking_nonce":"afc8cd8c69",
|
||||
"post_thumbnail":"41584",
|
||||
"post_name":"test_hugo",
|
||||
"ID":"41586",
|
||||
"form_type_confirm":"",
|
||||
"post_type":"post",
|
||||
"post_date":"2024-03-22 22:59:57"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------
|
||||
offre 1 'masquer' :
|
||||
---
|
||||
- BEFORE PROCESS :
|
||||
form_id: "crea_partenaire"
|
||||
post_array: {
|
||||
"post_status":"publish",
|
||||
"field_title":[
|
||||
"Nom commercial",
|
||||
"Votre site Internet",
|
||||
"Dans quelle rubrique devez-vous para\u00eetre ? ",
|
||||
"L\\'accroche en t\u00eate de page",
|
||||
"Pr\u00e9sentez-vous",
|
||||
"Votre logo ",
|
||||
"Image principale",
|
||||
"Voulez-vous afficher cette offre 1 ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"slug"
|
||||
],
|
||||
"post_title":"test_hugo",
|
||||
"meta_input":[
|
||||
"de_fb_url_partenaire",
|
||||
"de_fb_logo_partenaire",
|
||||
"de_fb_afficher_offre_1",
|
||||
"de_fb_duree_offre_1",
|
||||
"de_fb_fin_offre_1",
|
||||
"de_fb_offre_1_titre",
|
||||
"de_fb_offre_1_txt",
|
||||
"de_fb_offre_1_image",
|
||||
"de_fb_afficher_offre_2",
|
||||
"de_fb_duree_offre_2",
|
||||
"de_fb_fin_offre_2",
|
||||
"de_fb_offre_2_titre",
|
||||
"de_fb_offre_2_txt",
|
||||
"de_fb_offre_2_image",
|
||||
"de_fb_afficher_offre_3",
|
||||
"de_fb_duree_offre_3",
|
||||
"de_fb_fin_offre_3",
|
||||
"de_fb_offre_3_titre",
|
||||
"de_fb_offre_3_txt",
|
||||
"de_fb_offre_3_image"
|
||||
],
|
||||
"url_partenaire":"",
|
||||
"tax_input":[
|
||||
"de_fb_category"
|
||||
],
|
||||
"category":"autres",
|
||||
"post_excerpt":"accroche",
|
||||
"post_content":"presentation",
|
||||
"_ajax_linking_nonce":"afc8cd8c69",
|
||||
"logo_partenaire":"41585",
|
||||
"post_thumbnail":"41584",
|
||||
"afficher_offre_1":"Masquer",
|
||||
"offre_1_image":"41587",
|
||||
"afficher_offre_2":"Afficher",
|
||||
"duree_offre_2":"Permanente",
|
||||
"offre_2_titre":"titre 2",
|
||||
"offre_2_txt":"offre 2",
|
||||
"offre_2_image":"41588",
|
||||
"afficher_offre_3":"Afficher",
|
||||
"duree_offre_3":"Permanente",
|
||||
"offre_3_titre":"titre 3",
|
||||
"offre_3_txt":"offre 3",
|
||||
"offre_3_image":"41589",
|
||||
"post_name":"test_hugo",
|
||||
"ID":"41586",
|
||||
"form_type_confirm":""
|
||||
}
|
||||
form_type: "post"
|
||||
- BEFORE INSERT :
|
||||
form_id: "crea_partenaire"
|
||||
post_array: {
|
||||
"post_status":"publish",
|
||||
"field_title":[
|
||||
"Nom commercial",
|
||||
"Votre site Internet",
|
||||
"Dans quelle rubrique devez-vous para\u00eetre ? ",
|
||||
"L\\'accroche en t\u00eate de page",
|
||||
"Pr\u00e9sentez-vous",
|
||||
"Votre logo ",
|
||||
"Image principale",
|
||||
"Voulez-vous afficher cette offre 1 ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Dur\u00e9e de l\\'offre",
|
||||
"Validit\u00e9 de l\\'offre",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"slug"
|
||||
],
|
||||
"post_title":"test_hugo",
|
||||
"meta_input":{
|
||||
"url_partenaire":"",
|
||||
"_url_partenaire":"field_65cb83096d020",
|
||||
"logo_partenaire":"41585",
|
||||
"_logo_partenaire":"field_65cb79150ac4f",
|
||||
"afficher_offre_1":"Masquer",
|
||||
"_afficher_offre_1":"field_65d8cf09395a5",
|
||||
"duree_offre_1":[],
|
||||
"fin_offre_1":[],
|
||||
"offre_1_titre":[],
|
||||
"offre_1_txt":[],
|
||||
"offre_1_image":"41587",
|
||||
"_offre_1_image":"field_65d8bc5d5bf8b",
|
||||
"afficher_offre_2":"Afficher",
|
||||
"_afficher_offre_2":"field_65e20fb8785ba",
|
||||
"duree_offre_2":"Permanente",
|
||||
"_duree_offre_2":"field_65f3fc577fec4",
|
||||
"fin_offre_2":[],
|
||||
"offre_2_titre":"titre 2",
|
||||
"_offre_2_titre":"field_65d8bc201740b",
|
||||
"offre_2_txt":"offre 2",
|
||||
"_offre_2_txt":"field_65d8bc4c5bf89",
|
||||
"offre_2_image":"41588",
|
||||
"_offre_2_image":"field_65d8bc6e5bf8c",
|
||||
"afficher_offre_3":"Afficher",
|
||||
"_afficher_offre_3":"field_65d8cf48395a6",
|
||||
"duree_offre_3":"Permanente",
|
||||
"_duree_offre_3":"field_65f3ff78c7ffd",
|
||||
"fin_offre_3":[],
|
||||
"offre_3_titre":"titre 3",
|
||||
"_offre_3_titre":"field_65d8bc2e644ab",
|
||||
"offre_3_txt":"offre 3",
|
||||
"_offre_3_txt":"field_65d8bc545bf8a",
|
||||
"offre_3_image":"41589",
|
||||
"_offre_3_image":"field_65d8bc8c5bf8e"
|
||||
},
|
||||
"tax_input":{"category":[1]},
|
||||
"post_excerpt":"accroche",
|
||||
"post_content":"presentation",
|
||||
"_ajax_linking_nonce":"afc8cd8c69",
|
||||
"post_thumbnail":"41584",
|
||||
"post_name":"test_hugo",
|
||||
"ID":"41586",
|
||||
"form_type_confirm":"",
|
||||
"post_type":"post",
|
||||
"post_date":"2024-03-22 22:59:57"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
post_array: {
|
||||
- "post_status":"publish",
|
||||
- "field_title":["Nom commercial","Votre site Internet","Dans quelle rubrique devez-vous para\u00eetre ? ","L\\'accroche en t\u00eate de page","Pr\u00e9sentez-vous","Votre logo ","Image principale","Voulez-vous afficher cette offre 1 ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","slug"],
|
||||
- "post_title":"test_hugo",
|
||||
- "meta_input":["de_fb_url_partenaire","de_fb_logo_partenaire","de_fb_afficher_offre_1","de_fb_duree_offre_1","de_fb_fin_offre_1","de_fb_offre_1_titre","de_fb_offre_1_txt","de_fb_offre_1_image","de_fb_afficher_offre_2","de_fb_duree_offre_2","de_fb_fin_offre_2","de_fb_offre_2_titre","de_fb_offre_2_txt","de_fb_offre_2_image","de_fb_afficher_offre_3","de_fb_duree_offre_3","de_fb_fin_offre_3","de_fb_offre_3_titre","de_fb_offre_3_txt","de_fb_offre_3_image"],
|
||||
-"url_partenaire":"",
|
||||
- "tax_input":["de_fb_category"],
|
||||
"category":"autres",
|
||||
- "post_excerpt":"accroche",
|
||||
- "post_content":"presentation",
|
||||
- "_ajax_linking_nonce":"afc8cd8c69",
|
||||
-"logo_partenaire":"41585",
|
||||
- "post_thumbnail":"41584",
|
||||
-"afficher_offre_1":"Masquer",
|
||||
-"offre_1_image":"41587",
|
||||
-"afficher_offre_2":"Afficher",
|
||||
-"duree_offre_2":"Permanente",
|
||||
-"offre_2_titre":"titre 2",
|
||||
-"offre_2_txt":"offre 2",
|
||||
-"offre_2_image":"41588",
|
||||
-"afficher_offre_3":"Afficher",
|
||||
-"duree_offre_3":"Permanente",
|
||||
-"offre_3_titre":"titre 3",
|
||||
-"offre_3_txt":"offre 3",
|
||||
-"offre_3_image":"41589",
|
||||
- "post_name":"test_hugo",
|
||||
- "ID":"41586",
|
||||
- "form_type_confirm":""
|
||||
}
|
||||
form_type: "post"
|
||||
- BEFORE INSERT :
|
||||
form_id: "crea_partenaire"
|
||||
post_array: {
|
||||
- "post_status":"publish",
|
||||
- "field_title":["Nom commercial","Votre site Internet","Dans quelle rubrique devez-vous para\u00eetre ? ","L\\'accroche en t\u00eate de page","Pr\u00e9sentez-vous","Votre logo ","Image principale","Voulez-vous afficher cette offre 1 ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","Voulez-vous afficher cette offre ?","Dur\u00e9e de l\\'offre","Validit\u00e9 de l\\'offre","Titre","Texte de l\\'offre","Image (facultatif)","slug"],
|
||||
- "post_title":"test_hugo",
|
||||
- "meta_input":{
|
||||
- "url_partenaire":"", "_url_partenaire":"field_65cb83096d020",
|
||||
- "logo_partenaire":"41585", "_logo_partenaire":"field_65cb79150ac4f",
|
||||
- "afficher_offre_1":"Masquer", "_afficher_offre_1":"field_65d8cf09395a5",
|
||||
o "duree_offre_1":[],
|
||||
o "fin_offre_1":[],
|
||||
o "offre_1_titre":[],
|
||||
o "offre_1_txt":[],
|
||||
- "offre_1_image":"41587", "_offre_1_image":"field_65d8bc5d5bf8b",
|
||||
- "afficher_offre_2":"Afficher", "_afficher_offre_2":"field_65e20fb8785ba",
|
||||
- "duree_offre_2":"Permanente", "_duree_offre_2":"field_65f3fc577fec4",
|
||||
o "fin_offre_2":[],
|
||||
- "offre_2_titre":"titre 2", "_offre_2_titre":"field_65d8bc201740b",
|
||||
- "offre_2_txt":"offre 2", "_offre_2_txt":"field_65d8bc4c5bf89",
|
||||
- "offre_2_image":"41588", "_offre_2_image":"field_65d8bc6e5bf8c",
|
||||
- "afficher_offre_3":"Afficher", "_afficher_offre_3":"field_65d8cf48395a6",
|
||||
- "duree_offre_3":"Permanente", "_duree_offre_3":"field_65f3ff78c7ffd",
|
||||
o "fin_offre_3":[],
|
||||
- "offre_3_titre":"titre 3", "_offre_3_titre":"field_65d8bc2e644ab",
|
||||
- "offre_3_txt":"offre 3", "_offre_3_txt":"field_65d8bc545bf8a",
|
||||
- "offre_3_image":"41589", "_offre_3_image":"field_65d8bc8c5bf8e"
|
||||
},
|
||||
- "tax_input":{"category":[1]},
|
||||
- "post_excerpt":"accroche",
|
||||
- "post_content":"presentation",
|
||||
- "_ajax_linking_nonce":"afc8cd8c69",
|
||||
- "post_thumbnail":"41584",
|
||||
- "post_name":"test_hugo",
|
||||
- "ID":"41586",
|
||||
- "form_type_confirm":"",
|
||||
+ "post_type":"post",
|
||||
+ "post_date":"2024-03-22 22:59:57"
|
||||
}
|
||||
*/
|
||||
|
||||
//function partner_form_redirection_CIPF($form_id, $submit_result, $redirect_url_after_submission) {
|
||||
// error_log("---in partner_form_redirection_CIPF");
|
||||
// error_log("form_id");
|
||||
// error_log(json_encode($form_id));
|
||||
// error_log("submit_result");
|
||||
// error_log(json_encode($submit_result));
|
||||
// error_log("redirect_url_after_submission");
|
||||
// error_log(json_encode($redirect_url_after_submission));
|
||||
//}
|
||||
//do_action('df_before_redirect', 'partner_form_redirection_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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 partner_form_redirection_CIPF($form_id, $submit_result, $redirect_url_after_submission) {
|
||||
error_log("---in partner_form_redirection_CIPF");
|
||||
error_log("form_id");
|
||||
error_log(json_encode($form_id));
|
||||
error_log("submit_result");
|
||||
error_log(json_encode($submit_result));
|
||||
error_log("redirect_url_after_submission");
|
||||
error_log(json_encode($redirect_url_after_submission));
|
||||
}
|
||||
do_action('df_before_redirect', 'partner_form_redirection_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -10,42 +10,6 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
|
||||
//function check_fields_CIPF($fields) {
|
||||
// error_log("--- in check_fields_CIPF");
|
||||
// error_log("fields");
|
||||
// error_log(json_encode($fields));
|
||||
//
|
||||
// $tmp_fields = array_slice($fields, 0);
|
||||
// error_log("tmp_fields");
|
||||
// error_log(json_encode($tmp_fields));
|
||||
// $tmp_fields[] = array(
|
||||
// "field_type"=>"test",
|
||||
// "input_type"=>"text",
|
||||
// "settings"=>array
|
||||
// (
|
||||
// "required"=>"yes",
|
||||
// "label"=>"",
|
||||
// "cols"=>"onehalf",
|
||||
// "icon"=>"",
|
||||
// "placeholder"=>"test",
|
||||
// "minlength"=>"",
|
||||
// "maxlength"=>"",
|
||||
// "class"=>"",
|
||||
// "active"=>"no",
|
||||
// "unique_id"=>"test"
|
||||
// ),
|
||||
// "priority"=>"10"
|
||||
// );
|
||||
// error_log("--tmp_fields");
|
||||
// error_log(json_encode($tmp_fields));
|
||||
// error_log("--fields");
|
||||
// error_log(json_encode($fields));
|
||||
//
|
||||
//
|
||||
// return $fields;
|
||||
//}
|
||||
//add_filter('xoo_el_register_fields', 'check_fields_CIPF');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -82,7 +46,7 @@ add_action('xoo_el_register_add_fields', 'add_fields_register_CIPF');
|
||||
* -> change role to 'partenaire'
|
||||
*
|
||||
*/
|
||||
function add_partenaires_CIPF($customer_data){
|
||||
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;
|
||||
@@ -93,486 +57,15 @@ function add_partenaires_CIPF($customer_data){
|
||||
*
|
||||
*/
|
||||
if (!isset($_POST[$input_hidden_role])) {
|
||||
error_log("not set _POST[input_hidden_role]");
|
||||
return;
|
||||
}
|
||||
if ($_POST[$input_hidden_role] === $role_partner) {
|
||||
error_log("_POST[input_hidden_role] === partner");
|
||||
$customer_data['role'] = $role_partner;
|
||||
}
|
||||
return $customer_data;
|
||||
}
|
||||
add_filter('xoo_el_register_new_customer_data', 'add_partenaires_CIPF', 10, 1);
|
||||
/*
|
||||
profs :
|
||||
wp: {
|
||||
"public_query_vars":{"0":"m","1":"p","2":"posts","3":"w","4":"cat","5":"withcomments","6":"withoutcomments","7":"s","8":"search","9":"exact","10":"sentence","11":"calendar","12":"page","13":"paged","14":"more","15":"tb","16":"pb","17":"author","18":"order","19":"orderby","20":"year","21":"monthnum","22":"day","23":"hour","24":"minute","25":"second","26":"name","27":"category_name","28":"tag","29":"feed","30":"author_name","31":"pagename","32":"page_id","33":"error","34":"attachment","35":"attachment_id","36":"subpost","37":"subpost_id","38":"preview","39":"robots","40":"favicon","41":"taxonomy","42":"term","43":"cpage","44":"post_type","45":"embed","46":"post_format","47":"layout_category","48":"layout_tag","49":"layout_pack","50":"layout_type","51":"module_width","52":"scope","53":"et_tb_item_type","57":"rest_route","58":"sitemap","59":"sitemap-subtype","60":"sitemap-stylesheet","61":"et_code_snippet_type"},
|
||||
"private_query_vars":["offset","posts_per_page","posts_per_archive_page","showposts","nopaging","post_type","post_status","category__in","category__not_in","category__and","tag__in","tag__not_in","tag__and","tag_slug__in","tag_slug__and","tag_id","post_mime_type","perm","comments_per_page","post__in","post__not_in","post_parent","post_parent__in","post_parent__not_in","title","fields"],
|
||||
"extra_query_vars":[],
|
||||
"query_vars":[],
|
||||
"query_string":"",
|
||||
"request":"",
|
||||
"matched_rule":"",
|
||||
"matched_query":"",
|
||||
"did_permalink":false
|
||||
}
|
||||
_POST: {
|
||||
"xoo_el_reg_username":"beknomakka",
|
||||
"xoo_el_reg_email":"beknomakka@gufum.com",
|
||||
"xoo_el_reg_pass":"pouetpouet",
|
||||
"_xoo_el_form":"register",
|
||||
"xoo_el_redirect":"\/redirection_cipf",
|
||||
"action":"xoo_el_form_action",
|
||||
"display":"inline"
|
||||
}
|
||||
add_filter('xoo_el_register_new_customer_data', 'add_role_partners_CIPF', 10, 1);
|
||||
|
||||
partners :
|
||||
wp: {"public_query_vars":{"0":"m","1":"p","2":"posts","3":"w","4":"cat","5":"withcomments","6":"withoutcomments","7":"s","8":"search","9":"exact","10":"sentence","11":"calendar","12":"page","13":"paged","14":"more","15":"tb","16":"pb","17":"author","18":"order","19":"orderby","20":"year","21":"monthnum","22":"day","23":"hour","24":"minute","25":"second","26":"name","27":"category_name","28":"tag","29":"feed","30":"author_name","31":"pagename","32":"page_id","33":"error","34":"attachment","35":"attachment_id","36":"subpost","37":"subpost_id","38":"preview","39":"robots","40":"favicon","41":"taxonomy","42":"term","43":"cpage","44":"post_type","45":"embed","46":"post_format","47":"layout_category","48":"layout_tag","49":"layout_pack","50":"layout_type","51":"module_width","52":"scope","53":"et_tb_item_type","57":"rest_route","58":"sitemap","59":"sitemap-subtype","60":"sitemap-stylesheet","61":"et_code_snippet_type"},"private_query_vars":["offset","posts_per_page","posts_per_archive_page","showposts","nopaging","post_type","post_status","category__in","category__not_in","category__and","tag__in","tag__not_in","tag__and","tag_slug__in","tag_slug__and","tag_id","post_mime_type","perm","comments_per_page","post__in","post__not_in","post_parent","post_parent__in","post_parent__not_in","title","fields"],"extra_query_vars":[],"query_vars":[],"query_string":"","request":"","matched_rule":"","matched_query":"","did_permalink":false}
|
||||
_POST: {
|
||||
"xoo_el_reg_username":"jardozespi",
|
||||
"xoo_el_reg_email":"jardozespi@gufum.com",
|
||||
"xoo_el_reg_pass":"pouetpouet",
|
||||
"_xoo_el_form":"register",
|
||||
"cipf_user_role":"partenaire",
|
||||
"xoo_el_redirect":"\/redirection_cipf",
|
||||
"action":"xoo_el_form_action",
|
||||
"display":"inline"
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
|
||||
*
|
||||
*/
|
||||
//function check_created_user_CIPF($customer_id, $new_customer_data) {
|
||||
// error_log("--- in check_created_user_CIPF");
|
||||
// error_log("customer_id: " . json_encode($customer_id));
|
||||
// error_log("new_customer_data: " . json_encode($new_customer_data));
|
||||
// $user_metas = get_user_meta($customer_id);
|
||||
// error_log("user metas: " . json_encode($user_metas));
|
||||
//}
|
||||
//add_action('xoo_el_created_customer', 'check_created_user_CIPF', 10, 2);
|
||||
|
||||
|
||||
//function temp_test_data_cipf($extra_data) {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// $input_hidden_role = PLGNTLS_class::INPUT_HIDDEN_ROLE;
|
||||
//
|
||||
// error_log("- in temp_test_data_cipf, extra data: " . json_encode($extra_data));
|
||||
// $extra_data[$input_hidden_role] = '';
|
||||
// error_log("- after, extra data: " . json_encode($extra_data));
|
||||
// return $extra_data;
|
||||
//}
|
||||
//add_filter('xoo_aff_easy-login-woocommerce_data', 'temp_test_data_cipf');
|
||||
|
||||
/*
|
||||
|
||||
steps :
|
||||
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
|
||||
- 257 : function process_registration()
|
||||
- 273 : get_fields_data() -> reg_admin_fields: {"xoo_el_reg_fname":{"field_type":"xoo_el_reg_fname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"First Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_fname"},"priority":"10"},"xoo_el_reg_lname":{"field_type":"xoo_el_reg_lname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"Last Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_lname"},"priority":"20"},"xoo_el_reg_username":{"field_type":"xoo_el_reg_username","input_type":"text","settings":{"active":"yes","label":"Cr\u00e9er votre identifiant","cols":"one","icon":"fas fa-user-plus","placeholder":"","minlength":"3","maxlength":"20","class":"","unique_id":"xoo_el_reg_username","required":"yes"},"priority":"30"},"xoo_el_reg_email":{"field_type":"xoo_el_reg_email","input_type":"email","settings":{"active":"yes","required":"yes","label":"Votre adresse mail","cols":"one","icon":"fas fa-at","placeholder":"","class":"","unique_id":"xoo_el_reg_email"},"priority":"40"},"xoo_el_reg_pass":{"field_type":"xoo_el_reg_pass","input_type":"password","settings":{"active":"yes","label":"Cr\u00e9ez votre mot de passe","cols":"one","icon":"fas fa-key","placeholder":"8 caract\u00e8res minimum","minlength":"8","maxlength":"100","password_visibility":"yes","class":"","unique_id":"xoo_el_reg_pass","required":"yes"},"priority":"50"},"xoo_el_reg_pass_again":{"field_type":"xoo_el_reg_pass_again","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirm Password","password_visibility":"yes","class":"","active":"no","unique_id":"xoo_el_reg_pass_again","required":"yes"},"priority":"60"},"xoo_el_reg_terms":{"field_type":"xoo_el_reg_terms","input_type":"checkbox_single","settings":{"required":"yes","label":"","placeholder":"The Terms and Conditions","cols":"one","checkbox_single":{"yes":{"checked":"","label":"I accept the <a href=\"privacy-policy\" target=\"_blank\"> Terms of Service and Privacy Policy <\/a>","value":"yes","priority":"10"}},"class":"","active":"no","unique_id":"xoo_el_reg_terms"},"priority":"70"},"xoo-el-username":{"field_type":"xoo-el-username","input_type":"text","settings":{"label":"Identifiant ou email","cols":"one","icon":"fas fa-user-plus","placeholder":"","class":"","unique_id":"xoo-el-username","required":"yes","active":"yes","elType":"login","custom_attributes":{"autocomplete":"username"}},"priority":"80"},"xoo-el-password":{"field_type":"xoo-el-password","input_type":"password","settings":{"label":"Mot de passe","cols":"one","icon":"fas fa-key","placeholder":"","password_visibility":"yes","class":"","unique_id":"xoo-el-password","required":"yes","elType":"login","custom_attributes":{"autocomplete":"current-password"}},"priority":"90"},"xoo-el-rp-pass":{"field_type":"xoo-el-rp-pass","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Nouveau mot de passe","minlength":"6","maxlength":"20","password_visibility":"yes","class":"","unique_id":"xoo-el-rp-pass","required":"yes","elType":"resetpw"},"priority":"100"},"xoo-el-rp-pass-again":{"field_type":"xoo-el-rp-pass-again","input_type":"password","settings":{"required":"yes","unique_id":"xoo-el-rp-pass-again","elType":"resetpw","label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirmer le mot de passe","password_visibility":"yes","class":""},"priority":"110"},"user_login":{"field_type":"user_login","input_type":"text","settings":{"label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":"","unique_id":"user_login","required":"yes","active":"yes","elType":"lostpw"},"priority":"120"},"xoo-el-sing-user":{"field_type":"xoo-el-sing-user","input_type":"text","settings":{"unique_id":"xoo-el-sing-user","required":"yes","active":"yes","elType":"single","custom_attributes":{"autocomplete":"username"},"xoo_el_username":"yes","label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":""},"priority":990}}
|
||||
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/xoo-form-fields-fw/admin/class-xoo-aff-fields.php
|
||||
- 39 : public function get_fields_data( $format = 'array' )
|
||||
-> 47 : return apply_filters( 'xoo_aff_'.$this->plugin_slug.'_data', $data );
|
||||
- 275 : $doNotValidateOtherFields = get_fields('register') -> doNotValidateOtherFields: ["xoo-el-username","xoo-el-password","xoo-el-rp-pass","xoo-el-rp-pass-again","user_login","xoo-el-sing-user"]
|
||||
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-fields.php
|
||||
- 28 : public function get_fields( $type = 'register' )
|
||||
-> 58 : return apply_filters( 'xoo_el_'.$type.'_fields', $fields );
|
||||
- 277 : $fieldValues = validate_submitted_field_values( $_POST, $doNotValidateOtherFields ); -> fieldValues: {"xoo_el_reg_username":"nofyobopso","xoo_el_reg_email":"nofyobopso@gufum.com","xoo_el_reg_pass":"pouetpouet"}
|
||||
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/xoo-form-fields-fw/admin/class-xoo-aff-fields.php
|
||||
- 1213 : public function validate_submitted_field_values( $values = array(), $do_not_validate_ids = array() )
|
||||
- 1222 : $fields = $this->get_fields_data()
|
||||
- list that does not contains the contains the form fields
|
||||
- values: {"xoo_el_reg_username":"tamludupsi","xoo_el_reg_email":"tamludupsi@gufum.com","xoo_el_reg_pass":"pouetpouet","_xoo_el_form":"register","cipf_user_role":"partenaire","xoo_el_redirect":"\/redirection_cipf","action":"xoo_el_form_action","display":"inline"}
|
||||
- fields: {
|
||||
"xoo_el_reg_fname":{"field_type":"xoo_el_reg_fname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"First Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_fname"},"priority":"10"},
|
||||
"xoo_el_reg_lname":{"field_type":"xoo_el_reg_lname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"Last Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_lname"},"priority":"20"},
|
||||
"xoo_el_reg_username":{"field_type":"xoo_el_reg_username","input_type":"text","settings":{"active":"yes","label":"Cr\u00e9er votre identifiant","cols":"one","icon":"fas fa-user-plus","placeholder":"","minlength":"3","maxlength":"20","class":"","unique_id":"xoo_el_reg_username","required":"yes"},"priority":"30"},
|
||||
"xoo_el_reg_email":{"field_type":"xoo_el_reg_email","input_type":"email","settings":{"active":"yes","required":"yes","label":"Votre adresse mail","cols":"one","icon":"fas fa-at","placeholder":"","class":"","unique_id":"xoo_el_reg_email"},"priority":"40"},
|
||||
"xoo_el_reg_pass":{"field_type":"xoo_el_reg_pass","input_type":"password","settings":{"active":"yes","label":"Cr\u00e9ez votre mot de passe","cols":"one","icon":"fas fa-key","placeholder":"8 caract\u00e8res minimum","minlength":"8","maxlength":"100","password_visibility":"yes","class":"","unique_id":"xoo_el_reg_pass","required":"yes"},"priority":"50"},
|
||||
"xoo_el_reg_pass_again":{"field_type":"xoo_el_reg_pass_again","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirm Password","password_visibility":"yes","class":"","active":"no","unique_id":"xoo_el_reg_pass_again","required":"yes"},"priority":"60"},
|
||||
"xoo_el_reg_terms":{"field_type":"xoo_el_reg_terms","input_type":"checkbox_single","settings":{"required":"yes","label":"","placeholder":"The Terms and Conditions","cols":"one","checkbox_single":{"yes":{"checked":"","label":"I accept the <a href=\"privacy-policy\" target=\"_blank\"> Terms of Service and Privacy Policy <\/a>","value":"yes","priority":"10"}},"class":"","active":"no","unique_id":"xoo_el_reg_terms"},"priority":"70"},
|
||||
"xoo-el-username":{"field_type":"xoo-el-username","input_type":"text","settings":{"label":"Identifiant ou email","cols":"one","icon":"fas fa-user-plus","placeholder":"","class":"","unique_id":"xoo-el-username","required":"yes","active":"yes","elType":"login","custom_attributes":{"autocomplete":"username"}},"priority":"80"},
|
||||
"xoo-el-password":{"field_type":"xoo-el-password","input_type":"password","settings":{"label":"Mot de passe","cols":"one","icon":"fas fa-key","placeholder":"","password_visibility":"yes","class":"","unique_id":"xoo-el-password","required":"yes","elType":"login","custom_attributes":{"autocomplete":"current-password"}},"priority":"90"},
|
||||
"xoo-el-rp-pass":{"field_type":"xoo-el-rp-pass","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Nouveau mot de passe","minlength":"6","maxlength":"20","password_visibility":"yes","class":"","unique_id":"xoo-el-rp-pass","required":"yes","elType":"resetpw"},"priority":"100"},
|
||||
"xoo-el-rp-pass-again":{"field_type":"xoo-el-rp-pass-again","input_type":"password","settings":{"required":"yes","unique_id":"xoo-el-rp-pass-again","elType":"resetpw","label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirmer le mot de passe","password_visibility":"yes","class":""},"priority":"110"},
|
||||
"user_login":{"field_type":"user_login","input_type":"text","settings":{"label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":"","unique_id":"user_login","required":"yes","active":"yes","elType":"lostpw"},"priority":"120"},
|
||||
"xoo-el-sing-user":{"field_type":"xoo-el-sing-user","input_type":"text","settings":{"unique_id":"xoo-el-sing-user","required":"yes","active":"yes","elType":"single","custom_attributes":{"autocomplete":"username"},"xoo_el_username":"yes","label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":""},"priority":990}
|
||||
}
|
||||
|
||||
|
||||
---
|
||||
|
||||
do_action( 'xoo_el_created_customer', $customer_id, $new_customer_data);
|
||||
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
|
||||
|
||||
prof :
|
||||
customer_id: 194
|
||||
new_customer_data: {
|
||||
"user_login":"dultiropso",
|
||||
"user_pass":"pouetpouet",
|
||||
"user_email":"dultiropso@gufum.com",
|
||||
"role":"professeur__professeure"
|
||||
}
|
||||
user metas: {
|
||||
"nickname":["dultiropso"],
|
||||
"first_name":[""],
|
||||
"last_name":[""],
|
||||
"description":[""],
|
||||
"rich_editing":["true"],
|
||||
"syntax_highlighting":["true"],
|
||||
"comment_shortcuts":["false"],
|
||||
"admin_color":["fresh"],
|
||||
"use_ssl":["0"],
|
||||
"show_admin_bar_front":["true"],
|
||||
"locale":[""],
|
||||
"wp_503463_capabilities":["a:1:{s:23:\"professeur__professeure\";b:1;}"],
|
||||
"wp_503463_user_level":["0"],
|
||||
"dismissed_wp_pointers":[""]
|
||||
}
|
||||
|
||||
partner :
|
||||
customer_id: 195
|
||||
new_customer_data: {
|
||||
"user_login":"mistahirdu",
|
||||
"user_pass":"pouetpouet",
|
||||
"user_email":"mistahirdu@gufum.com",
|
||||
"role":"professeur__professeure"
|
||||
}
|
||||
user metas: {
|
||||
"nickname":["mistahirdu"],
|
||||
"first_name":[""],
|
||||
"last_name":[""],
|
||||
"description":[""],
|
||||
"rich_editing":["true"],
|
||||
"syntax_highlighting":["true"],
|
||||
"comment_shortcuts":["false"],
|
||||
"admin_color":["fresh"],
|
||||
"use_ssl":["0"],
|
||||
"show_admin_bar_front":["true"],
|
||||
"locale":[""],
|
||||
"wp_503463_capabilities":["a:1:{s:23:\"professeur__professeure\";b:1;}"],
|
||||
"wp_503463_user_level":["0"],
|
||||
"dismissed_wp_pointers":[""]
|
||||
}
|
||||
|
||||
|
||||
---
|
||||
|
||||
do_action( 'xoo_el_register_add_fields', $args );
|
||||
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/templates/global/xoo-el-register-section.php
|
||||
|
||||
args :
|
||||
{
|
||||
"display":"inline",
|
||||
"form_active":"register",
|
||||
"return":true,
|
||||
"navstyle":"disable",
|
||||
"forms":
|
||||
{
|
||||
"single":{"enable":"no"},
|
||||
"login":{"enable":"yes"},
|
||||
"register":{"enable":"yes"},
|
||||
"lostpw":{"enable":"yes"}
|
||||
},
|
||||
"tabs":["register"]
|
||||
}
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
function check_data_CIPF($data) {
|
||||
error_log("--- in check_data_CIPF");
|
||||
error_log("data");
|
||||
error_log(json_encode($data));
|
||||
|
||||
return $data;
|
||||
}
|
||||
add_filter('xoo_aff_easy-login-woocommerce_data', 'check_data_CIPF');
|
||||
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/xoo-form-fields-fw/admin/class-xoo-aff-fields.php
|
||||
|
||||
|
||||
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-fields.php
|
||||
|
||||
{
|
||||
"xoo_el_reg_fname":
|
||||
{
|
||||
"field_type":"xoo_el_reg_fname",
|
||||
"input_type":"text",
|
||||
"settings":
|
||||
{
|
||||
"required":"yes",
|
||||
"label":"",
|
||||
"cols":"onehalf",
|
||||
"icon":"far fa-user",
|
||||
"placeholder":"First Name",
|
||||
"minlength":"",
|
||||
"maxlength":"",
|
||||
"class":"",
|
||||
"active":"no",
|
||||
"unique_id":"xoo_el_reg_fname"
|
||||
},
|
||||
"priority":"10"
|
||||
},
|
||||
"xoo_el_reg_lname":
|
||||
{
|
||||
"field_type":"xoo_el_reg_lname",
|
||||
"input_type":"text",
|
||||
"settings":
|
||||
{
|
||||
"required":"yes",
|
||||
"label":"",
|
||||
"cols":"onehalf",
|
||||
"icon":"far fa-user",
|
||||
"placeholder":"Last Name",
|
||||
"minlength":"",
|
||||
"maxlength":"",
|
||||
"class":"",
|
||||
"active":"no",
|
||||
"unique_id":"xoo_el_reg_lname"
|
||||
},
|
||||
"priority":"20"
|
||||
},
|
||||
"xoo_el_reg_username":
|
||||
{
|
||||
"field_type":"xoo_el_reg_username",
|
||||
"input_type":"text",
|
||||
"settings":
|
||||
{
|
||||
"active":"yes",
|
||||
"label":"Cr\u00e9er votre identifiant",
|
||||
"cols":"one",
|
||||
"icon":"fas fa-user-plus",
|
||||
"placeholder":"",
|
||||
"minlength":"3",
|
||||
"maxlength":"20",
|
||||
"class":"",
|
||||
"unique_id":"xoo_el_reg_username",
|
||||
"required":"yes"
|
||||
},
|
||||
"priority":"30"
|
||||
},
|
||||
"xoo_el_reg_email":
|
||||
{
|
||||
"field_type":"xoo_el_reg_email",
|
||||
"input_type":"email",
|
||||
"settings":
|
||||
{
|
||||
"active":"yes",
|
||||
"required":"yes",
|
||||
"label":"Votre adresse mail",
|
||||
"cols":"one",
|
||||
"icon":"fas fa-at",
|
||||
"placeholder":"",
|
||||
"class":"",
|
||||
"unique_id":"xoo_el_reg_email"
|
||||
},
|
||||
"priority":"40"
|
||||
},
|
||||
"xoo_el_reg_pass":
|
||||
{
|
||||
"field_type":"xoo_el_reg_pass",
|
||||
"input_type":"password",
|
||||
"settings":
|
||||
{
|
||||
"active":"yes",
|
||||
"label":"Cr\u00e9ez votre mot de passe",
|
||||
"cols":"one",
|
||||
"icon":"fas fa-key",
|
||||
"placeholder":"8 caract\u00e8res minimum",
|
||||
"minlength":"8",
|
||||
"maxlength":"100",
|
||||
"password_visibility":"yes",
|
||||
"class":"",
|
||||
"unique_id":"xoo_el_reg_pass",
|
||||
"required":"yes"
|
||||
},
|
||||
"priority":"50"
|
||||
},
|
||||
"xoo_el_reg_pass_again":
|
||||
{
|
||||
"field_type":"xoo_el_reg_pass_again",
|
||||
"input_type":"password",
|
||||
"settings":
|
||||
{
|
||||
"label":"",
|
||||
"cols":"one",
|
||||
"icon":"fas fa-key",
|
||||
"placeholder":"Confirm Password",
|
||||
"password_visibility":"yes",
|
||||
"class":"",
|
||||
"active":"no",
|
||||
"unique_id":"xoo_el_reg_pass_again",
|
||||
"required":"yes"
|
||||
},
|
||||
"priority":"60"
|
||||
},
|
||||
"xoo_el_reg_terms":
|
||||
{
|
||||
"field_type":"xoo_el_reg_terms",
|
||||
"input_type":"checkbox_single",
|
||||
"settings":
|
||||
{
|
||||
"required":"yes",
|
||||
"label":"",
|
||||
"placeholder":"The Terms and Conditions",
|
||||
"cols":"one",
|
||||
"checkbox_single":
|
||||
{
|
||||
"yes":
|
||||
{
|
||||
"checked":"",
|
||||
"label":"I accept the <a href=\"privacy-policy\" target=\"_blank\"> Terms of Service and Privacy Policy <\/a>",
|
||||
"value":"yes",
|
||||
"priority":"10"
|
||||
}
|
||||
},
|
||||
"class":"",
|
||||
"active":"no",
|
||||
"unique_id":"xoo_el_reg_terms"
|
||||
},
|
||||
"priority":"70"
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* BAD OLD METHOD
|
||||
* when arriving on the partner registration page
|
||||
* -> add an option (really not a good idea)
|
||||
* option is bad, it will be global to all users
|
||||
*
|
||||
*/
|
||||
//function check_if_partner_registration_CIPF() {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// $slug_partner_registration = PLGNTLS_class::SLUG_PARTNER_REGISTRATION;
|
||||
// $option_partner_slug = PLGNTLS_class::OPTION_PARTNER_SLUG;
|
||||
//
|
||||
//
|
||||
// /*
|
||||
// * if does not exist, create the option
|
||||
// */
|
||||
// if (false === get_option($option_partner_slug['_name'])) {
|
||||
// add_option($option_partner_slug['_name'], array());
|
||||
// }
|
||||
//
|
||||
// global $wp;
|
||||
// $current_slug = $wp->request;
|
||||
// if ($current_slug !== $slug_partner_registration) {
|
||||
// update_option($option_partner_slug['_name'], $option_partner_slug['false']);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //PLGNTLS_class::set_partner_registration();
|
||||
// update_option($option_partner_slug['_name'], $option_partner_slug['true']);
|
||||
//}
|
||||
//add_action('template_redirect', 'check_if_partner_registration_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* BAD OLD METHOD
|
||||
* at registration, add role 'partenaire'
|
||||
* if option (created with hook 'template redirect') has the partner registration slug
|
||||
* -> give partner role
|
||||
* option is bad, it will be global to all users
|
||||
*
|
||||
*/
|
||||
//function add_partenaires_CIPF($customer_data){
|
||||
// PLGNTLS_class::debug_infos();
|
||||
// $role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
// $option_partner_slug = PLGNTLS_class::OPTION_PARTNER_SLUG;
|
||||
//
|
||||
// /*
|
||||
// */
|
||||
// $partner_slug_option = get_option($option_partner_slug['_name']);
|
||||
// $is_partner_slug = false;
|
||||
// if ($partner_slug_option === $option_partner_slug['true']) {
|
||||
// $is_partner_slug = true;
|
||||
// }
|
||||
// if ($is_partner_slug) {
|
||||
// $customer_data['role'] = $role_partner;
|
||||
// }
|
||||
// return $customer_data;
|
||||
//}
|
||||
//add_filter('xoo_el_register_new_customer_data', 'add_partenaires_CIPF', 10, 1);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
in add_partenaires
|
||||
_POST
|
||||
{
|
||||
"xoo_el_reg_username":"tistilarde",
|
||||
"xoo_el_reg_email":"tistilarde@gufum.com",
|
||||
"xoo_el_reg_pass":"pouetpouet",
|
||||
"_xoo_el_form":"register",
|
||||
"xoo_el_redirect":"\/creation-du-compte-partenaire\/",
|
||||
"action":"xoo_el_form_action",
|
||||
"display":"popup"
|
||||
}
|
||||
|
||||
_SERVER
|
||||
{
|
||||
"SERVER_SOFTWARE":"nginx\/1.20.2",
|
||||
"REQUEST_URI":"\/wp-admin\/admin-ajax.php",
|
||||
"USER":"www-data",
|
||||
"HOME":"\/home\/www-data",
|
||||
"HTTP_SEC_FETCH_SITE":"same-origin",
|
||||
"HTTP_SEC_FETCH_MODE":"cors",
|
||||
"HTTP_SEC_FETCH_DEST":"empty",
|
||||
"HTTP_COOKIE":"wordpress_test_cookie=WP%20Cookie%20check; wp-postpass_351da2be51e3820c1ef099eec9d2e669=%24P%24BjEiJgHo.cgrpONdnfmxwpIYzraFCP.; mjx.menu=renderer%3ANativeMML%26%3Bsemantics%3Atrue%26%3Bcontext%3ABrowser%26%3Bzoom%3ANone",
|
||||
"HTTP_REFERER":"https:\/\/local-cipf-plugin.com\/creation-du-compte-partenaire\/",
|
||||
"HTTP_CONNECTION":"keep-alive",
|
||||
"HTTP_SEC_GPC":"1",
|
||||
"HTTP_DNT":"1",
|
||||
"HTTP_ORIGIN":"https:\/\/local-cipf-plugin.com",
|
||||
"HTTP_CONTENT_LENGTH":"211",
|
||||
"HTTP_X_REQUESTED_WITH":"XMLHttpRequest",
|
||||
"HTTP_CONTENT_TYPE":"application\/x-www-form-urlencoded; charset=UTF-8",
|
||||
"HTTP_ACCEPT_ENCODING":"gzip, deflate, br",
|
||||
"HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.5",
|
||||
"HTTP_ACCEPT":"*\/*",
|
||||
"HTTP_USER_AGENT":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko\/20100101 Firefox\/123.0",
|
||||
"HTTP_HOST":"local-cipf-plugin.com",
|
||||
"REDIRECT_STATUS":"200",
|
||||
"SERVER_NAME":"local-cipf-plugin.com",
|
||||
"SERVER_PORT":"443",
|
||||
"SERVER_ADDR":"172.20.0.4",
|
||||
"REMOTE_PORT":"58976",
|
||||
"REMOTE_ADDR":"172.20.0.1",
|
||||
"GATEWAY_INTERFACE":"CGI\/1.1",
|
||||
"HTTPS":"on",
|
||||
"REQUEST_SCHEME":"https",
|
||||
"SERVER_PROTOCOL":"HTTP\/1.1",
|
||||
"DOCUMENT_ROOT":"\/var\/www\/html",
|
||||
"DOCUMENT_URI":"\/wp-admin\/admin-ajax.php",
|
||||
"SCRIPT_NAME":"\/wp-admin\/admin-ajax.php",
|
||||
"CONTENT_LENGTH":"211",
|
||||
"CONTENT_TYPE":"application\/x-www-form-urlencoded; charset=UTF-8",
|
||||
"REQUEST_METHOD":"POST",
|
||||
"QUERY_STRING":"",
|
||||
"SCRIPT_FILENAME":"\/var\/www\/html\/wp-admin\/admin-ajax.php",
|
||||
"FCGI_ROLE":"RESPONDER",
|
||||
"PHP_SELF":"\/wp-admin\/admin-ajax.php",
|
||||
"REQUEST_TIME_FLOAT":1710328883.257681,
|
||||
"REQUEST_TIME":1710328883
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
|
||||
29
plugins/fbpatch/fbpatch.php
Normal file
29
plugins/fbpatch/fbpatch.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: fbpatch_plugin
|
||||
Plugin URI:
|
||||
Description: some patchs for the form_builder plugin's bugs
|
||||
Author: hugogogo
|
||||
Version: 0.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!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
include_once(plugin_dir_path(__FILE__) . '/php/fbpatch_class.php');
|
||||
include_once(plugin_dir_path(__FILE__) . '/php/calculations.php');
|
||||
|
||||
include_once(plugin_dir_path(__FILE__) . '/menu/admin_menu.php');
|
||||
include_once(plugin_dir_path(__FILE__) . '/menu/admin_menu_toggle.php');
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
70
plugins/fbpatch/js/calculations.js
Normal file
70
plugins/fbpatch/js/calculations.js
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
function patch_form_calculation_CIPF() {
|
||||
let form_calculation = document.querySelector('form.fb_form.multistep');
|
||||
if (form_calculation === null)
|
||||
return;
|
||||
|
||||
/*
|
||||
* finds the input:checked in the element .calculate_field
|
||||
* and trigger the event 'change' on it
|
||||
* - this event 'change' is added by form builder in divi-form-calc-min.js :
|
||||
* $(document).on(
|
||||
* 'change',
|
||||
* '.calculate_field input:not([type="hidden"]), .calculate_field select',
|
||||
* function () {
|
||||
* ...
|
||||
* }
|
||||
* );
|
||||
*
|
||||
*/
|
||||
function trigger_change(element) {
|
||||
/*
|
||||
* jquery version
|
||||
*
|
||||
let inputs = $(element).find('input:checked');
|
||||
inputs.trigger('change');
|
||||
*/
|
||||
|
||||
/*
|
||||
* js version
|
||||
*
|
||||
*/
|
||||
let inputs = element.querySelectorAll('input:checked');
|
||||
// loop through inputs and trigger 'change' event on each
|
||||
inputs.forEach(function(input) {
|
||||
// Triggering 'change' event
|
||||
let change_event = new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
input.dispatchEvent(change_event);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// create an observer on form to check if child nodes are modified
|
||||
const observer_form = new MutationObserver(wait_for_calculation_class);
|
||||
observer_form.observe(form_calculation, {
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
});
|
||||
|
||||
// observe mutations to see if they include the addition of class .calculate_field
|
||||
// if the class is added, call the function that might trigger the change event on it
|
||||
function wait_for_calculation_class(mutationsList) {
|
||||
mutationsList.forEach((mutation) => {
|
||||
// check if class where added
|
||||
if (mutation.type !== 'attributes')
|
||||
return;
|
||||
if (mutation.attributeName !== 'class')
|
||||
return;
|
||||
// check if added class is .calculate_field
|
||||
let target = mutation.target;
|
||||
if (target.classList.contains('calculate_field')) {
|
||||
// If the class is added, trigger the 'change' event
|
||||
trigger_change(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
patch_form_calculation_CIPF();
|
||||
48
plugins/fbpatch/menu/admin_menu.php
Normal file
48
plugins/fbpatch/menu/admin_menu.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/*
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* the construction of the admin menu page
|
||||
*
|
||||
*/
|
||||
function plugin_content() {
|
||||
echo "<p>hello</p>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* menu plugin
|
||||
*/
|
||||
function plugin_menu() {
|
||||
$menu_page_title = 'fbpatch';
|
||||
$menu_title = 'fbpatch';
|
||||
$menu_capability = 'manage_options';
|
||||
$menu_slug = 'fbpatch-plugin';
|
||||
$menu_callback = __NAMESPACE__.'\plugin_content';
|
||||
|
||||
\FBPATCH\toggle_menu($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback);
|
||||
}
|
||||
add_action('admin_menu', __NAMESPACE__.'\plugin_menu');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
108
plugins/fbpatch/menu/admin_menu_toggle.php
Normal file
108
plugins/fbpatch/menu/admin_menu_toggle.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/*
|
||||
* 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 toggle_menu($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback) {
|
||||
$toggle_menu = Fbpatch::OPTION_TOGGLE_MENU;
|
||||
|
||||
if (false === get_option($toggle_menu['_name'])) {
|
||||
add_option($toggle_menu['_name'], $toggle_menu['hide']);
|
||||
}
|
||||
|
||||
$toggle = get_option($toggle_menu['_name']);
|
||||
|
||||
if ($toggle === $toggle_menu['hide']) {
|
||||
remove_menu_page($menu_slug);
|
||||
}
|
||||
else if ($toggle === $toggle_menu['show']) {
|
||||
add_menu_page($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* add link under the plugin in the plugins admin page
|
||||
*
|
||||
*/
|
||||
function add_link_to_plugin($links) {
|
||||
$slug_toggle = Fbpatch::SLUG_TOOGLE_ADMIN_MENU;
|
||||
$toggle_menu = Fbpatch::OPTION_TOGGLE_MENU;
|
||||
|
||||
$toggle = get_option($toggle_menu['_name']);
|
||||
|
||||
if ($toggle === $toggle_menu['hide']) {
|
||||
$links[] = '<a href="/'.$slug_toggle['_name'].'?'.$slug_toggle['toggle'].'='.$slug_toggle['show'].'">show menu</a>';
|
||||
}
|
||||
else if ($toggle === $toggle_menu['show']) {
|
||||
$links[] = '<a href="/'.$slug_toggle['_name'].'?'.$slug_toggle['toggle'].'='.$slug_toggle['hide'].'">hide menu</a>';
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
add_filter('plugin_action_links_fbpatch/fbpatch.php', __NAMESPACE__.'\add_link_to_plugin');
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* handle the toggle menu when url is reached
|
||||
*
|
||||
*/
|
||||
function toggle_plugin_menu() {
|
||||
$slug_toggle = Fbpatch::SLUG_TOOGLE_ADMIN_MENU;
|
||||
$toggle_menu = Fbpatch::OPTION_TOGGLE_MENU;
|
||||
|
||||
global $wp;
|
||||
$current_slug = $wp->request;
|
||||
if ($current_slug !== $slug_toggle['_name']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$show = null;
|
||||
if (!isset($_GET)) {
|
||||
$show = null;
|
||||
}
|
||||
else if (empty($_GET)) {
|
||||
$show = null;
|
||||
}
|
||||
if (!isset($_GET[$slug_toggle['toggle']])) {
|
||||
$show = null;
|
||||
}
|
||||
else if ($_GET[$slug_toggle['toggle']] === $slug_toggle['show']) {
|
||||
$show = true;
|
||||
}
|
||||
else if ($_GET[$slug_toggle['toggle']] === $slug_toggle['hide']) {
|
||||
$show = false;
|
||||
}
|
||||
|
||||
if ($show === true) {
|
||||
update_option($toggle_menu['_name'], $toggle_menu['show']);
|
||||
}
|
||||
else if ($show === false) {
|
||||
update_option($toggle_menu['_name'], $toggle_menu['hide']);
|
||||
}
|
||||
|
||||
$plugins_menu_url = admin_url('plugins.php');
|
||||
wp_redirect($plugins_menu_url, 301);
|
||||
exit;
|
||||
}
|
||||
add_action('template_redirect', __NAMESPACE__.'\toggle_plugin_menu');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
27
plugins/fbpatch/php/calculations.php
Normal file
27
plugins/fbpatch/php/calculations.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/*
|
||||
* 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 add_form_builder_calculations_patch() {
|
||||
$handle = 'form_builder_calculations_patch';
|
||||
$url = plugin_dir_url(__DIR__) . '/js/calculations.js';
|
||||
$dependencies = array('de_fb_calc');
|
||||
$version = null;
|
||||
$defer = true;
|
||||
wp_enqueue_script($handle, $url, $dependencies, $version, $defer);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_calculations_patch', 22);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
30
plugins/fbpatch/php/fbpatch_class.php
Normal file
30
plugins/fbpatch/php/fbpatch_class.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/*
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class Fbpatch {
|
||||
|
||||
const SLUG_TOOGLE_ADMIN_MENU = ['_name'=>'toogle_admin_menu_url_fbpatch', 'toggle'=>'toggle', 'show'=>'show', 'hide'=>'hide'];
|
||||
const OPTION_TOGGLE_MENU = ['_name'=>'toggle_admin_menu_option_fbpatch', 'show'=>'show', 'hide'=>'hide'];
|
||||
|
||||
//private static $_is_
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user