From 1856943bc94b097a0da626befb8900585f59a8aa Mon Sep 17 00:00:00 2001 From: asus Date: Sun, 24 Mar 2024 15:14:53 +0100 Subject: [PATCH] wip adding patchs conditionnaly --- plugins/fbpatch/fbpatch.php | 4 +++- plugins/fbpatch/php/calculations.php | 2 +- plugins/fbpatch/php/fbpatch_class.php | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/fbpatch/fbpatch.php b/plugins/fbpatch/fbpatch.php index 3b6d3e6..c837a80 100644 --- a/plugins/fbpatch/fbpatch.php +++ b/plugins/fbpatch/fbpatch.php @@ -18,12 +18,14 @@ if (!defined('ABSPATH')) { 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'); include_once(plugin_dir_path(__FILE__) . '/menu/menu_content.php'); +include_once(plugin_dir_path(__FILE__) . '/php/calculations.php'); + +\FBPATCH\Fbpatch::init_hook(); diff --git a/plugins/fbpatch/php/calculations.php b/plugins/fbpatch/php/calculations.php index aaa0da4..2e35003 100644 --- a/plugins/fbpatch/php/calculations.php +++ b/plugins/fbpatch/php/calculations.php @@ -20,7 +20,7 @@ function add_form_builder_calculations_patch() { $defer = true; wp_enqueue_script($handle, $url, $dependencies, $version, $defer); } -add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_calculations_patch', 22); +//add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_calculations_patch', 22); diff --git a/plugins/fbpatch/php/fbpatch_class.php b/plugins/fbpatch/php/fbpatch_class.php index 4f2890b..605e90b 100644 --- a/plugins/fbpatch/php/fbpatch_class.php +++ b/plugins/fbpatch/php/fbpatch_class.php @@ -25,7 +25,7 @@ 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'], + 'hide_show' =>['checked'=>false, 'title'=>'hide/show title', 'description'=>'hide/show description'], ]; //private static $_patches = ['_name'=>'fbpatch_list_of_patches', 'hide_show']; //private static $_patches = ['_name'=>'fbpatch_list_of_patches']; @@ -107,6 +107,11 @@ class Fbpatch { $serialize_patches_option = serialize($patches_option); update_option(self::$_patches['_name'], $serialize_patches_option); } + + public static function init_hook() { + add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_calculations_patch', 22); + } + }