1ShoppingCart.com Custom Form to your blog. Usage: Goto 'Appearance >> Widgets' and add the '1SC Custom Forms' widget to the sidebar. Then goto 'Signup Form' in the Admin sidbar to setup the form. Author: 1shoppingcart.com Author URI: http://1shoppingcart.com Copyright 2009 1shoppingcart.com (email : support@1shoppingcart.com) */ /* * Set up options if they do not exist */ add_option('oneshop_merchantid', '00000'); add_option('oneshop_ARThankyouURL'); add_option('oneshop_ARThankyouURL_wp', 1); add_option('oneshop_copyarresponse'); add_option('oneshop_ar1'); add_option('oneshop_ar2'); add_option('oneshop_ar3'); add_option('oneshop_ar4'); add_option('oneshop_ar5'); add_option('oneshop_ar1_check'); add_option('oneshop_ar2_check'); add_option('oneshop_ar3_check'); add_option('oneshop_ar4_check'); add_option('oneshop_ar5_check'); add_option('oneshop_width', '15'); add_option('oneshop_submit_type', 'button'); // button, text, image add_option('oneshop_submit_button_text', 'Submit'); add_option('oneshop_submit_image_url', ''); add_option('oneshop_submit_text', 'Submit'); add_option('oneshop_field_name_Name_required', '2'); add_option('oneshop_field_name_Email_required', '2'); add_option('oneshop_field_name_Company_required', '0'); add_option('oneshop_field_name_HomePhone_required', '0'); add_option('oneshop_field_name_WorkPhone_required', '0'); add_option('oneshop_field_name_Address1_required', '0'); add_option('oneshop_field_name_Address2_required', '0'); add_option('oneshop_field_name_City_required', '0'); add_option('oneshop_field_name_State_required', '0'); add_option('oneshop_field_name_Zip_required', '0'); add_option('oneshop_field_name_Country_required', '0'); add_option('oneshop_field_name_Fax_required', '0'); add_option('oneshop_field_name_Custom1_required', '0'); add_option('oneshop_field_name_Custom2_required', '0'); add_option('oneshop_field_name_Custom3_required', '0'); add_option('oneshop_field_name_Custom4_required', '0'); add_option('oneshop_field_name_Custom5_required', '0'); add_option('oneshop_field_name_Custom6_required', '0'); add_option('oneshop_field_name_Custom7_required', '0'); add_option('oneshop_field_name_Custom8_required', '0'); add_option('oneshop_field_name_Custom9_required', '0'); add_option('oneshop_field_name_Custom10_required', '0'); add_option('oneshop_field_name_Custom10_rows', '3'); add_option('oneshop_field_name_Custom10_cols', '25'); add_option('oneshop_field_name_Custom10_text', 'Enter Your Comments Here.'); add_option('oneshop_field_name_Name_label', 'Name'); add_option('oneshop_field_name_Email_label', 'Email'); add_option('oneshop_field_name_Company_label', 'Company'); add_option('oneshop_field_name_HomePhone_label', 'Home Phone'); add_option('oneshop_field_name_WorkPhone_label', 'Work Phone'); add_option('oneshop_field_name_Address1_label', 'Address'); add_option('oneshop_field_name_Address2_label', 'Address 2'); add_option('oneshop_field_name_City_label', 'City'); add_option('oneshop_field_name_State_label', 'State'); add_option('oneshop_field_name_Zip_label', 'Zip'); add_option('oneshop_field_name_Country_label', 'Country'); add_option('oneshop_field_name_Fax_label', 'Fax'); add_option('oneshop_field_name_Custom1_label'); add_option('oneshop_field_name_Custom2_label'); add_option('oneshop_field_name_Custom3_label'); add_option('oneshop_field_name_Custom4_label'); add_option('oneshop_field_name_Custom5_label'); add_option('oneshop_field_name_Custom6_label'); add_option('oneshop_field_name_Custom7_label'); add_option('oneshop_field_name_Custom8_label'); add_option('oneshop_field_name_Custom9_label'); add_option('oneshop_field_name_Custom10_label'); add_option('oneshop_sidebar_install_type', 'widget'); add_option('oneshop_sidebar_tag_outer', 'li'); add_option('oneshop_sidebar_tag_inner', 'h2'); add_option('oneshop_sidebar_tag_outer_attributes_name', ''); add_option('oneshop_sidebar_tag_outer_attributes_value', ''); add_option('oneshop_sidebar_tag_inner_attributes_name', ''); add_option('oneshop_sidebar_tag_inner_attributes_value', ''); add_option('oneshop_sidebar_tag_inner_label', 'Newsletter'); add_option('oneshop_sidebar_tag_inner_label_align', 'right'); add_option('oneshop_sidebar_custom_text_1', ''); add_option('oneshop_sidebar_custom_text_1_check'); add_option('oneshop_sidebar_custom_text_1_align', 'none'); add_option('oneshop_sidebar_custom_text_2', ''); add_option('oneshop_sidebar_custom_text_2_check'); add_option('oneshop_sidebar_custom_text_2_align', 'none'); //validation text add_option('oneshop_field_name_Name_missing_field_color', '#f99'); add_option('oneshop_field_name_Name_missing_field_text_color', '#f00'); add_option('oneshop_field_name_Name_missing_field_validate_message', 'Please fill in required fields.'); add_option('oneshop_field_name_Name_validate_message', 'Please Enter Your Name'); add_option('oneshop_field_name_Email_invalid_message', 'Please enter a valid email address, example: you@yourdomain.com'); add_option('oneshop_field_name_Email_validate_message', 'Please Enter an Email Address'); add_option('oneshop_field_name_Company_validate_message', 'Please Enter Your Company Name'); add_option('oneshop_field_name_HomePhone_validate_message', 'Please Enter Your Home Phone Number'); add_option('oneshop_field_name_WorkPhone_validate_message', 'Please Enter Your Work Phone Number'); add_option('oneshop_field_name_Address1_validate_message', 'Please Enter Your Address'); add_option('oneshop_field_name_Address2_validate_message', 'Please Enter Your Address2'); add_option('oneshop_field_name_City_validate_message', 'Please Enter Your City'); add_option('oneshop_field_name_State_validate_message', 'Please Enter Your State'); add_option('oneshop_field_name_Zip_validate_message', 'Please Enter Your Zip Code'); add_option('oneshop_field_name_Country_validate_message', 'Please Enter Your Country'); add_option('oneshop_field_name_Fax_validate_message', 'Please Enter Your Fax Number'); add_option('oneshop_field_name_Custom1_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom2_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom3_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom4_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom5_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom6_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom7_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom8_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom9_validate_message', 'Field is required'); add_option('oneshop_field_name_Custom10_validate_message', 'Field is required'); // Pre-2.6 compatibility if ( ! defined( 'WP_CONTENT_URL' ) ) define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); if ( ! defined( 'WP_CONTENT_DIR' ) ) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); if ( ! defined( 'WP_PLUGIN_URL' ) ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' ); if ( ! defined( 'WP_PLUGIN_DIR' ) ) define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Guess the location $oneshop_path = WP_PLUGIN_DIR.'/'.plugin_basename(dirname(__FILE__)); $oneshop_url = WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)); function widget_oneshop_form($args) { extract($args); echo $before_widget; echo $before_title.get_option('oneshop_sidebar_tag_inner_label').$after_title; oneshop_form(TRUE); echo $after_widget; } function oneshop_form_init() { wp_enqueue_script('jquery-validate', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/jquery.validate.js',array('jquery'),'1.5.5'); wp_enqueue_script('oneshop-validate', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/oneshop-validation.js.php',array('jquery-validate'),'1.0'); register_sidebar_widget(__('1SC Custom Forms'), 'widget_oneshop_form'); } add_action("plugins_loaded", "oneshop_form_init"); function oneshop_form($oneshop_is_widget = FALSE) { echo ""; ?> "; echo "\n<".get_option('oneshop_sidebar_tag_inner'); if (get_option('oneshop_sidebar_tag_inner_attributes_name') != "" && get_option('oneshop_sidebar_tag_inner_attributes_value') != "") { echo" ".get_option('oneshop_sidebar_tag_inner_attributes_name')."='".get_option('oneshop_sidebar_tag_inner_attributes_value')."'"; } echo ">".get_option('oneshop_sidebar_tag_inner_label').""; } echo "\n
"; echo " "; if(get_option('oneshop_ar1_check') != "true" && get_option('oneshop_ar2_check') != "true" && get_option('oneshop_ar3_check') != "true" && get_option('oneshop_ar4_check') != "true" && get_option('oneshop_ar5_check') != "true") { echo "\n\t"; } if(get_option('oneshop_ar1_check') == "true") { echo "\n"; } if(get_option('oneshop_ar2_check') == "true") { echo "\n"; } if(get_option('oneshop_ar3_check') == "true") { echo "\n"; } if(get_option('oneshop_ar4_check') == "true") { echo "\n"; } if(get_option('oneshop_ar5_check') == "true") { echo "\n"; } echo "\n"; echo "\n
"; echo "\n"; // Custom text at top if(get_option('oneshop_sidebar_custom_text_1_check') == 'true') { echo "\n\t"; echo "\n\t\t"; echo "\n\t"; } $oneshop_visible_fields = "\n\t"; echo "\n\t\t"; echo "\n\t\t"; echo "\n\t"; $oneshop_visible_fields .= ",".$oneshop_fields_array_item[0].""; if(get_option($oneshop_fields_array_item[2]) == 2) { $oneshop_required_fields .= ",".$oneshop_fields_array_item[0].""; } } } $oneshop_custom_fields_array = array( array( "Custom1", 'oneshop_field_name_Custom1_label', 'oneshop_field_name_Custom1_required', '1', ), array( "Custom2", 'oneshop_field_name_Custom2_label', 'oneshop_field_name_Custom2_required', '2', ), array( "Custom3", 'oneshop_field_name_Custom3_label', 'oneshop_field_name_Custom3_required', '3', ), array( "Custom4", 'oneshop_field_name_Custom4_label', 'oneshop_field_name_Custom4_required', '4', ), array( "Custom5", 'oneshop_field_name_Custom5_label', 'oneshop_field_name_Custom5_required', '5', ), array( "Custom6", 'oneshop_field_name_Custom6_label', 'oneshop_field_name_Custom6_required', '6', ), array( "Custom7", 'oneshop_field_name_Custom7_label', 'oneshop_field_name_Custom7_required', '7', ), array( "Custom8", 'oneshop_field_name_Custom8_label', 'oneshop_field_name_Custom8_required', '8', ), array( "Custom9", 'oneshop_field_name_Custom9_label', 'oneshop_field_name_Custom9_required', '9' )); foreach($oneshop_custom_fields_array as $oneshop_fields_custom_array_item) { // Custom fields 1-9 0.5.8 if(get_option($oneshop_fields_custom_array_item[2]) == 1 || get_option($oneshop_fields_custom_array_item[2]) == 2) { echo"\n\t"; echo" \n\t\t"; echo" \n\t\t"; echo "\n\t\t"; echo "\n\t"; } } // Custom 10 if(get_option('oneshop_field_name_Custom10_required') == 1 || get_option('oneshop_field_name_Custom10_required') == 2) { echo"\n"; if(trim(get_option('oneshop_field_name_Custom10_label')) != "") { echo ""; } $oneshop_visible_fields .= "'>"; $oneshop_required_fields .= "'>"; echo $oneshop_visible_fields; echo $oneshop_required_fields; echo"\n\t"; echo "\n\t\t"; echo "\n\t"; // Custom text at bottom if(get_option('oneshop_sidebar_custom_text_2_check') == 'true') { echo"\n\t"; echo "\n\t\t"; echo "\n\t"; } echo "\n
".get_option('oneshop_sidebar_custom_text_1'); echo "\n\t\t
"; $this_class = NULL; if (get_option($oneshop_fields_array_item[2]) == 2) { echo "\n\t\t\t"; $this_class = "required"; } else { echo "\n\t\t\t"; } if($oneshop_fields_array_item[0] == "Email1") { $this_class .= " email"; } echo "\n\t\t"; echo "\n\t\t\t"; echo "\n\t\t
"; if (get_option($oneshop_fields_custom_array_item[2]) == 2) { echo "\n\t\t\t".get_option($oneshop_fields_custom_array_item[1]).""; $onshop_this_required = "1"; $this_class = "required"; } else { echo "\n\t\t\t".get_option($oneshop_fields_custom_array_item[1]); echo "\n\t\t\t"; echo $onshop_this_required = ""; $this_class = ""; } echo "\n\t\t"; echo "\n\t\t\t"; echo "\n\t\t\t"; echo "\n\t\t
"; if (get_option('oneshop_field_name_Custom10_required') == 2) { echo "".get_option('oneshop_field_name_Custom10_label').""; $this_class = "required"; } else { echo get_option('oneshop_field_name_Custom10_label'); $this_class = ""; } echo ""; } else { echo ""; } echo "\n"; echo "
"; if(get_option('oneshop_submit_type') == "button") { echo "\n\t\t\t"; } elseif(get_option('oneshop_submit_type') == "text") { echo "\n\t\t\t".get_option('oneshop_submit_text').""; } elseif(get_option('oneshop_submit_type') == "image") { echo "\n\t\t\t"; } echo "\n\t\t
"; echo "\n\t\t\t".get_option('oneshop_sidebar_custom_text_2'); echo "\n\t\t
"; echo "\n
"; echo "\n
"; if(get_option('oneshop_sidebar_install_type') == "advanced" && $oneshop_is_widget == FALSE) { echo "\n"; } echo ""; } // Hook for adding admin menus add_action('admin_menu', 'oneshop_admin'); // action function for above hook function oneshop_admin() { // Add a new submenu under Options: add_menu_page('Custom Forms For 1ShoppingCart.com', 'Signup Form', 7, '1shop_custom_forms', 'oneshop_custom_forms_settings'); } function oneshop_custom_forms_settings() { // Pre-2.6 compatibility if ( ! defined( 'WP_CONTENT_URL' ) ) define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); if ( ! defined( 'WP_CONTENT_DIR' ) ) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); if ( ! defined( 'WP_PLUGIN_URL' ) ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' ); if ( ! defined( 'WP_PLUGIN_DIR' ) ) define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Guess the location $oneshop_path = WP_PLUGIN_DIR.'/'.plugin_basename(dirname(__FILE__)); $oneshop_url = WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)); echo "
"; echo "

Custom Forms For 1ShoppingCart.com

"; ?>

General Settings Show/Hide


Sidebar Layout Show/Hide


Form Fields Show/Hide