diff --git a/plugins/fbpatch/css/menu.css b/plugins/fbpatch/css/menu.css new file mode 100644 index 0000000..e69de29 diff --git a/plugins/fbpatch/html/menu.html b/plugins/fbpatch/html/menu.html index 902a2e1..c8df7ed 100644 --- a/plugins/fbpatch/html/menu.html +++ b/plugins/fbpatch/html/menu.html @@ -1,21 +1,24 @@ +
-
- - -
-
- - -
+ $options) {?> +
+ /> + +
+
diff --git a/plugins/fbpatch/menu/menu_content.php b/plugins/fbpatch/menu/menu_content.php index 1962cdc..a2d76cd 100644 --- a/plugins/fbpatch/menu/menu_content.php +++ b/plugins/fbpatch/menu/menu_content.php @@ -16,7 +16,8 @@ if (!defined('ABSPATH')) { * */ function plugin_content() { - $patches = Fbpatch::get_patchs(); + $patches = Fbpatch::get_patches(); + error_log("in plugin_content, patches: ".json_encode($patches)); $nonce = Fbpatch::NONCE; $admin_post_patches = Fbpatch::ADMIN_POST_PATCH_CHOICE; ob_start(); diff --git a/plugins/fbpatch/php/fbpatch_class.php b/plugins/fbpatch/php/fbpatch_class.php index 02c60c2..d95e5e5 100644 --- a/plugins/fbpatch/php/fbpatch_class.php +++ b/plugins/fbpatch/php/fbpatch_class.php @@ -22,10 +22,15 @@ class Fbpatch { const NONCE = ['_name'=>'nonce_name', '_action'=>'action_name']; const ADMIN_POST_PATCH_CHOICE = 'add_patches'; - private static $_patches = ['_name'=>'fbpatch_list_of_patches', 'calculations', 'hide_show']; + 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'], + ]; //private static $_patches = ['_name'=>'fbpatch_list_of_patches', 'hide_show']; + //private static $_patches = ['_name'=>'fbpatch_list_of_patches']; - private static function set_option_patchs() { + private static function set_option_patches() { error_log("---"); /* * get the list of patches in option @@ -47,14 +52,14 @@ class Fbpatch { * */ error_log("patches_option before 1: " . json_encode($patches_option)); - foreach (self::$_patches as $key => $patch) { - if ($key === '_name') { + foreach (self::$_patches as $patch => $data) { + if ($patch === '_name') { continue; } if (isset($patches_option[$patch])) { continue; } - $patches_option[$patch] = false; + $patches_option[$patch] = $data; } error_log("patches_option after 1: " . json_encode($patches_option)); @@ -63,11 +68,11 @@ class Fbpatch { * */ error_log("patches_option before 2: " . json_encode($patches_option)); - foreach ($patches_option as $key => $patch) { - if (in_array($key, self::$_patches)) { + foreach ($patches_option as $patch => $data) { + if (isset(self::$_patches[$patch])) { continue; } - unset($patches_option[$key]); + unset($patches_option[$patch]); } error_log("patches_option after 2: " . json_encode($patches_option)); @@ -81,10 +86,10 @@ class Fbpatch { error_log("serialize patches_option: " . json_encode($serialize_patches_option)); update_option(self::$_patches['_name'], $serialize_patches_option); } - public static function get_patchs() { - self::set_option_patchs(); + public static function get_patches() { + self::set_option_patches(); $patches = get_option(self::$_patches['_name']); - return serialize($patches); + return unserialize($patches); } public static function set_patchs($query) { }