fbpatch small fixes in options and hide-show
This commit is contained in:
@@ -44,10 +44,10 @@ class Fbpatch {
|
|||||||
|
|
||||||
private static $_patches = [
|
private static $_patches = [
|
||||||
'_name'=>'fbpatch_list_of_patches',
|
'_name'=>'fbpatch_list_of_patches',
|
||||||
'calculations'=>['checked'=>true, 'title'=>'calculations title', 'description'=>'calculation description'],
|
'calculations'=>['checked'=>true, 'title'=>'calculations', 'description'=>"afficher le total des calculs dès l'ouverture des formulaires"],
|
||||||
'hide_show' =>['checked'=>true, 'title'=>'hide/show title', 'description'=>'hide/show description'],
|
'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 title', 'description'=>'modals description'],
|
'modals' =>['checked'=>false, 'title'=>'modals', 'description'=>"permettre plusieurs modals sur une meme page"],
|
||||||
'urls' =>['checked'=>false, 'title'=>'urls title', 'description'=>'urls description'],
|
'urls' =>['checked'=>false, 'title'=>'urls', 'description'=>"permettre de rentrer des urls sans 'http://'"],
|
||||||
];
|
];
|
||||||
|
|
||||||
private static function set_option_patches() {
|
private static function set_option_patches() {
|
||||||
@@ -74,10 +74,15 @@ class Fbpatch {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isset($patches_option[$patch])) {
|
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;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the option has additional patches, delete them
|
* if the option has additional patches, delete them
|
||||||
@@ -181,25 +186,27 @@ 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() {
|
public static function init_skip_hook() {
|
||||||
if (false === self::$_has_elements_to_skip) {
|
if (true === self::$_has_elements_to_skip) {
|
||||||
remove_filter("update_post_metadata", __NAMESPACE__.'\filter_elements_to_skip');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
public static function end_skip_hook() {
|
||||||
|
if (true === self::$_has_elements_to_skip) {
|
||||||
remove_filter("update_post_metadata", __NAMESPACE__.'\filter_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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user