A_Reset_Form

Class A_Reset_Form.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php  
  1. class A_Reset_Form extends Mixin 
  2. function get_title() 
  3. return __('Reset Options', 'nggallery'); 
  4. function render() 
  5. return $this->object->render_partial('photocrati-nextgen_other_options#reset_tab', array('reset_value' => __('Reset all options to default settings', 'nggallery'), 'reset_warning' => __('Replace all existing options and gallery options with their default settings', 'nggallery'), 'reset_label' => __('Reset settings', 'nggallery'), 'reset_confirmation' => __("Reset all options to default settings?\n\nChoose [Cancel] to Stop, [OK] to proceed.", 'nggallery')), TRUE); 
  6. function reset_action() 
  7. global $wpdb; 
  8. // Flush the cache 
  9. C_Photocrati_Transient_Manager::flush(); 
  10. // Uninstall the plugin 
  11. $settings = C_NextGen_Settings::get_instance(); 
  12. if (defined('NGG_PRO_PLUGIN_VERSION') || defined('NEXTGEN_GALLERY_PRO_VERSION')) { 
  13. C_Photocrati_Installer::uninstall('photocrati-nextgen-pro'); 
  14. C_Photocrati_Installer::uninstall('photocrati-nextgen'); 
  15. // removes all ngg_options entry in wp_options 
  16. $settings->reset(); 
  17. $settings->destroy(); 
  18. // clear NextGEN's capabilities from the roles system 
  19. $capabilities = array("NextGEN Gallery overview", "NextGEN Use TinyMCE", "NextGEN Upload images", "NextGEN Manage gallery", "NextGEN Manage others gallery", "NextGEN Manage tags", "NextGEN Edit album", "NextGEN Change style", "NextGEN Change options", "NextGEN Attach Interface"); 
  20. $roles = array("subscriber", "contributor", "author", "editor", "administrator"); 
  21. foreach ($roles as $role) { 
  22. $role = get_role($role); 
  23. foreach ($capabilities as $capability) { 
  24. if (!is_null($role)) { 
  25. $role->remove_cap($capability); 
  26. // Some installations of NextGen that upgraded from 1.9x to 2.0x have duplicates installed,  
  27. // so for now (as of 2.0.21) we explicitly remove all display types and lightboxes from the 
  28. // db as a way of fixing this. 
  29. $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s", 'display_type')); 
  30. $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s", 'lightbox_library')); 
  31. // the installation will run on the next page load; so make our own request before reloading the browser 
  32. wp_remote_get(admin_url('plugins.php'), array('timeout' => 180, 'blocking' => true, 'sslverify' => false)); 
  33. header('Location: ' . get_admin_url()); 
  34. throw new E_Clean_Exit();