I would like if a person could produce top tips on creating this script, that we will increase the existing plug-in (see code below) script below.

What exactly I've now (using the script below) is a way to place a predefined group of defaults in to the wordpress site. What I am attempting to add, is really a assistant utility, triggered with a button or link that simply reads "Copy Configurations", which will have a site's existing configurations (the sb2_options), write that to some file, then package the resulting file, together with the initial file right into a new zip file that basically turns into a custom copy from the original plug-set for use within another site.

Therefore the code must take a current .php file that contains the static code, open it up up for writing, then place all of the title/value pairs in the wordpress options table matching a particular prefix (for instance, my custom choices are prefixed with "sb2_"). Once it's carried this out, it might save the resulting file as "wordpress plugin.zip", for instance and stream it towards the user for download.

This is actually the code which i have finally, which creates the site's defaults...

 Plugin Name: my plugin
 Description: Sets up your sites defaults.
 Version: 1.0

 function sb2_plugin_init() 

 if ( get_option( 'sb2_plugin' ) == "") 

 //Begin Insert List here. Open the file and write out all the name value pairs, just like in the example.

 //Option 1",
  $sb2_option1 = "test";

 //Option 2",
  $sb2_option2 = "test";

 //Option 1",
  $sb2_option3 = "test";

 //End insert list here

  //update site defaults
  update_option('sb2_option1', sb2_option1);
  update_option('sb2_option2', sb2_option2);
  update_option('sb2_option3', sb2_option3);

  // Create post objects
  $my_post = array();
  $my_post['post_title'] = 'Main Blog Post Title';
  $my_post['post_content'] = 'Main Blog Post Content';
  $my_post['post_type'] = 'post';


  // Insert the post into the database

  update_option('sb2_plugin', "1");

 add_action( 'init','sb2_plugin_init');

Reading through and conntacting file should not be a challenge for you personally but here's a great way to create zip files.