fbpatch small fixes in options and hide-show

This commit is contained in:
asus
2024-03-25 13:07:12 +01:00
parent 8ebbb8bff2
commit 6ec621a20b

View File

@@ -44,10 +44,10 @@ class Fbpatch {
private static $_patches = [
'_name'=>'fbpatch_list_of_patches',
'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'],
'calculations'=>['checked'=>true, 'title'=>'calculations', 'description'=>"afficher le total des calculs dès l'ouverture des formulaires"],
'hide_show' =>['checked'=>true, 'title'=>'masquer les offres', 'description'=>"permettre de masquer les offres en editant un formulaire, sans les supprimer"],
'modals' =>['checked'=>false, 'title'=>'modals', 'description'=>"permettre plusieurs modals sur une meme page"],
'urls' =>['checked'=>false, 'title'=>'urls', 'description'=>"permettre de rentrer des urls sans 'http://'"],
];
private static function set_option_patches() {
@@ -74,9 +74,14 @@ class Fbpatch {
continue;
}
if (isset($patches_option[$patch])) {
continue;
// updates the title and the description
$patches_option[$patch]['title'] = $data['title'];
$patches_option[$patch]['description'] = $data['description'];
}
else {
// add the option
$patches_option[$patch] = $data;
}
$patches_option[$patch] = $data;
}
/*
@@ -181,24 +186,26 @@ class Fbpatch {
}
/*
* if there is elements to skip, add the filter, otherwise removes it (to be sure)
* if there is elements to skip, add the filter
*
*/
public static function init_skip_hook() {
if (false === self::$_has_elements_to_skip) {
remove_filter("update_post_metadata", __NAMESPACE__.'\filter_elements_to_skip');
return;
if (true === self::$_has_elements_to_skip) {
add_filter("update_post_metadata", __NAMESPACE__.'\filter_elements_to_skip', 10, 5);
}
add_filter("update_post_metadata", __NAMESPACE__.'\filter_elements_to_skip', 10, 5);
}
/*
* after insertion finished, removes filter
* after insertion finished, removes filter and reset variables
*
*/
public static function end_skip_hook() {
remove_filter("update_post_metadata", __NAMESPACE__.'\filter_elements_to_skip');
if (true === self::$_has_elements_to_skip) {
remove_filter("update_post_metadata", __NAMESPACE__.'\filter_elements_to_skip');
}
self::$_post_id = 0;
self::$_has_elements_to_skip = false;
self::$_skip_elements = array();
}