function camera_add_general() { global $options, $wpdb; camera_init(); foreach ($options as $value) { if (!camera_get_option($value['id'])) { camera_add_option($value['id'], $value['std']); } } }
} elseif (isset($_REQUEST['camera_added_slideshows'])) { $camera_added_slideshows = camera_get_option('camera_added_slideshows'); $camera_added_slideshows_new = $_REQUEST['camera_added_slideshows']; $camera_added_slideshows_diff = array_diff($camera_added_slideshows, $camera_added_slideshows_new); foreach ($camera_added_slideshows_diff as $option => $value) { camera_delete_option('cameraarray_' . sanitize_title($value)); } foreach ($options as $value) { if (isset($_REQUEST[$value['id']])) { camera_update_option($value['id'], $_REQUEST[$value['id']]); } } } else { foreach ($_POST as $key => $value) { if (preg_match("/cameraarray/", $key)) { camera_delete_option($key); if (!camera_get_option($key)) { camera_add_option($key, $value); } else { camera_update_option($key, $value); } } } foreach ($options as $value) { if (isset($_REQUEST[$value['id']])) { camera_update_option($value['id'], $_REQUEST[$value['id']]); } } } } }