diff --git a/plugins/cipf_plugin/cipf_plugin.php b/plugins/cipf_plugin/cipf_plugin.php index cb098d6..e9c92ed 100644 --- a/plugins/cipf_plugin/cipf_plugin.php +++ b/plugins/cipf_plugin/cipf_plugin.php @@ -46,14 +46,6 @@ include_once(PLGNTLS_class::root_path() . 'php/partners_page.php'); include_once(PLGNTLS_class::root_path() . 'php/display_css.php'); -// form builder patch : -/* -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'); - diff --git a/plugins/cipf_plugin/css/hide_show_form_elements.css b/plugins/cipf_plugin/css/hide_show_form_elements.css deleted file mode 100644 index 8b13789..0000000 --- a/plugins/cipf_plugin/css/hide_show_form_elements.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/plugins/cipf_plugin/js/form_builder_patch/form_calculation.js b/plugins/cipf_plugin/js/form_builder_patch/form_calculation.js deleted file mode 100644 index 80c03be..0000000 --- a/plugins/cipf_plugin/js/form_builder_patch/form_calculation.js +++ /dev/null @@ -1,71 +0,0 @@ - -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(); - diff --git a/plugins/cipf_plugin/php/form_builder_patch/form_calculation.php b/plugins/cipf_plugin/php/form_builder_patch/form_calculation.php deleted file mode 100644 index 03b7970..0000000 --- a/plugins/cipf_plugin/php/form_builder_patch/form_calculation.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/plugins/cipf_plugin/php/form_builder_patch/hide_show_elements.php b/plugins/cipf_plugin/php/form_builder_patch/hide_show_elements.php deleted file mode 100644 index 9f708f1..0000000 --- a/plugins/cipf_plugin/php/form_builder_patch/hide_show_elements.php +++ /dev/null @@ -1,489 +0,0 @@ -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'); - - - - -?> diff --git a/plugins/cipf_plugin/php/form_builder_patch/multiple_modals.php b/plugins/cipf_plugin/php/form_builder_patch/multiple_modals.php deleted file mode 100644 index f13278e..0000000 --- a/plugins/cipf_plugin/php/form_builder_patch/multiple_modals.php +++ /dev/null @@ -1,24 +0,0 @@ -add_to_front( - array( - 'js/form_builder_patch/multiple_modals.js', - )); -} -add_shortcode('test_modal', 'test_modal_PLGNTLS'); - - - -?> diff --git a/plugins/cipf_plugin/js/form_builder_patch/multiple_modals.js b/plugins/fbpatch/js/modals.js similarity index 99% rename from plugins/cipf_plugin/js/form_builder_patch/multiple_modals.js rename to plugins/fbpatch/js/modals.js index 946f8b6..53d6e81 100644 --- a/plugins/cipf_plugin/js/form_builder_patch/multiple_modals.js +++ b/plugins/fbpatch/js/modals.js @@ -1,4 +1,3 @@ - let modal_wrapper_CIPF = document.querySelector('#de-fb-modal-wrapper-'); // create an observer on first #de-fb-modal-wrapper- to check if child nodes are added diff --git a/plugins/cipf_plugin/js/form_builder_patch/url_validation.js b/plugins/fbpatch/js/urls.js similarity index 99% rename from plugins/cipf_plugin/js/form_builder_patch/url_validation.js rename to plugins/fbpatch/js/urls.js index f7aeeb1..292a9ad 100644 --- a/plugins/cipf_plugin/js/form_builder_patch/url_validation.js +++ b/plugins/fbpatch/js/urls.js @@ -6,3 +6,4 @@ jQuery.validator.addMethod( 'url', function(value, element) { return url(value, element) || url('http://' + value, element); }, 'Please enter a valid URL' ); + diff --git a/plugins/fbpatch/menu/menu_content.php b/plugins/fbpatch/menu/menu_content.php index cf0611e..2009dce 100644 --- a/plugins/fbpatch/menu/menu_content.php +++ b/plugins/fbpatch/menu/menu_content.php @@ -20,7 +20,7 @@ function plugin_content() { $nonce = Fbpatch::NONCE; $admin_post_patches = Fbpatch::ADMIN_POST_PATCH_CHOICE; ob_start(); - include(plugin_dir_path(__DIR__) . '/html/menu.html'); + include(Fbpatch::root_path() . '/html/menu.html'); $html = ob_get_clean(); echo $html; diff --git a/plugins/fbpatch/php/fbpatch_class.php b/plugins/fbpatch/php/fbpatch_class.php index 96ab8a4..67cb602 100644 --- a/plugins/fbpatch/php/fbpatch_class.php +++ b/plugins/fbpatch/php/fbpatch_class.php @@ -16,7 +16,6 @@ if (!defined('ABSPATH')) { * */ 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']; const NONCE = ['_name'=>'nonce_name', '_action'=>'action_name']; @@ -24,12 +23,22 @@ class Fbpatch { private static $_patches = [ '_name'=>'fbpatch_list_of_patches', - 'calculations'=>['checked'=>false, 'title'=>'calculations title', 'description'=>'calculation description'], - 'hide_show' =>['checked'=>false, 'title'=>'hide/show title', 'description'=>'hide/show description'], + 'calculations'=>['checked'=>true, 'title'=>'calculations title', 'description'=>'calculation description'], + 'hide_show' =>['checked'=>true, 'title'=>'hide/show title', 'description'=>'hide/show description'], + 'modals' =>['checked'=>false, 'title'=>'modals title', 'description'=>'modals description'], + 'urls' =>['checked'=>false, 'title'=>'urls title', 'description'=>'urls description'], ]; //private static $_patches = ['_name'=>'fbpatch_list_of_patches', 'hide_show']; //private static $_patches = ['_name'=>'fbpatch_list_of_patches']; + public static function root_path() { + return plugin_dir_path(__DIR__); + } + public static function root_url() { + return plugin_dir_url(__DIR__); + } + + private static function set_option_patches() { /* * get the list of patches in option @@ -116,7 +125,7 @@ class Fbpatch { $patches = Fbpatch::get_patches(); foreach($patches as $patch => $data) { if ($data['checked'] === true) { - include_once(plugin_dir_path(__DIR__) . '/php/'.$patch.'.php'); + include_once(self::root_path() . '/php/patches/'.$patch.'.php'); } } } diff --git a/plugins/fbpatch/php/calculations.php b/plugins/fbpatch/php/patches/calculations.php similarity index 90% rename from plugins/fbpatch/php/calculations.php rename to plugins/fbpatch/php/patches/calculations.php index aaa0da4..8b461e8 100644 --- a/plugins/fbpatch/php/calculations.php +++ b/plugins/fbpatch/php/patches/calculations.php @@ -14,7 +14,7 @@ if (!defined('ABSPATH')) { */ function add_form_builder_calculations_patch() { $handle = 'form_builder_calculations_patch'; - $url = plugin_dir_url(__DIR__) . '/js/calculations.js'; + $url = Fbpatch::root_url() . '/js/calculations.js'; $dependencies = array('de_fb_calc'); $version = null; $defer = true; diff --git a/plugins/fbpatch/php/patches/hide_show.php b/plugins/fbpatch/php/patches/hide_show.php new file mode 100644 index 0000000..9a3c00d --- /dev/null +++ b/plugins/fbpatch/php/patches/hide_show.php @@ -0,0 +1,52 @@ +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($form_id, $post_array, $form_type) { + 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', __NAMESPACE__.'\form_partner_before_process', 10, 3); + +/* +* 506 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php +* +*/ +function form_partner_before_insert($form_id, $post_array) { + error_log("form_id: " . json_encode($form_id)); + error_log("post_array: " . json_encode($post_array)); +} +add_action('df_before_insert_post', __NAMESPACE__.'\form_partner_before_insert', 10, 2); + + + + + +?> + diff --git a/plugins/fbpatch/php/patches/modals.php b/plugins/fbpatch/php/patches/modals.php new file mode 100644 index 0000000..f1dd077 --- /dev/null +++ b/plugins/fbpatch/php/patches/modals.php @@ -0,0 +1,25 @@ + diff --git a/plugins/cipf_plugin/php/form_builder_patch/url_validation.php b/plugins/fbpatch/php/patches/urls.php similarity index 82% rename from plugins/cipf_plugin/php/form_builder_patch/url_validation.php rename to plugins/fbpatch/php/patches/urls.php index cd7a98a..32a0991 100644 --- a/plugins/cipf_plugin/php/form_builder_patch/url_validation.php +++ b/plugins/fbpatch/php/patches/urls.php @@ -1,4 +1,5 @@ -