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')."".get_option('oneshop_sidebar_tag_inner').">"; } echo "\n
"; if(get_option('oneshop_sidebar_install_type') == "advanced" && $oneshop_is_widget == FALSE) { echo "\n".get_option('oneshop_sidebar_tag_outer').">"; } 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 "