Beispiel #1
0
 private function Save_Options()
 {
     # Check if this is a post request
     if (empty($_POST)) {
         return False;
     }
     # Add Capabilities
     if (isset($_POST['capabilities']) && Is_Array($_POST['capabilities'])) {
         foreach ($_POST['capabilities'] as $role_name => $arr_role) {
             if (!($role = get_role($role_name))) {
                 continue;
             }
             foreach ((array) $arr_role as $capability => $yes_no) {
                 if ($yes_no == 'yes') {
                     $role->add_cap($capability);
                 } else {
                     $role->remove_cap($capability);
                 }
             }
         }
         unset($_POST['capabilities']);
     }
     # Clean the Post array
     $_POST = StripSlashes_Deep($_POST);
     foreach ($_POST as $option => $value) {
         if (!$value) {
             unset($_POST[$option]);
         }
     }
     # Save Options
     Update_Option(__CLASS__, $_POST);
     Delete_Option('wp_plugin_fancy_gallery_pro');
     Delete_Option('wp_plugin_fancy_gallery');
     # We delete the update cache
     $this->core->Clear_Plugin_Update_Cache();
     return True;
 }
Beispiel #2
0
 static function saveOptions()
 {
     # Check if this is a post request
     if (empty($_POST)) {
         return False;
     }
     # Clean the Post array
     $options = StripSlashes_Deep($_POST);
     $options = Array_Filter($options, function ($value) {
         return $value == '0' || !empty($value);
     });
     # Save Options
     Update_Option(self::$options_key, $options);
     return True;
 }