Before all else,be armed.
-Niccolo Machiavelli
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | } else if ($is_sidebar && $options['usecss']) { $content .= '<style type="text/css"> .sidebar form.w2llead{clear:none;text-align:left} .sidebar .w2linput,#sidebar .w2llabel{float:none;display:inline} .sidebar .w2llabel.error{color:#f00} .sidebar .w2llabel{margin:4px 0} .sidebar .w2linput.text{width:95%;height:18px;margin:4px 0} .sidebar .w2linput.textarea{width:95%;height:50px;margin:10px 0} .sidebar .w2linput.submit{margin:10px 0 0 0} #salesforce{margin:3px 0 0 0;color:#aaa} #salesforce a{color:#999} </style>'; } $sidebar = ''; if ($is_sidebar) $sidebar = ' sidebar'; $content .= "\n".'<form method="post">'."\n"; foreach ($options['inputs'] as $id => $input) { if (!$input['show']) continue; $val = ''; if (isset($_POST[$id])) $val = strip_tags(stripslashes($_POST[$id])); $error = ' '; if ($input['error']) $error = ' error '; $content .= "\t".'<label for="sf_'.$id.'">'.stripslashes($input['label']).':'; if ($input['required']) $content .= ' *'; $content .= '</label>'."\n"; if ($input['type'] == 'text') { $content .= "\t".'<input value="'.$val.'"id="sf_'.$id.'"name="'.$id.'"type="text"/><br/>'."\n\n"; } else if ($input['type'] == 'textarea') { $content .= "\t".'<br/>'."\n\t".'<textarea id="sf_'.$id.'"name="'.$id.'">'.$val.'</textarea><br/>'."\n\n"; } } $submit = stripslashes($options['submitbutton']); if (empty($submit)) $submit = "Submit"; $content .= "\t".'<input type="submit"name="w2lsubmit"value="'.$submit.'"/>'."\n"; $content .= '</form>'."\n"; $reqtext = stripslashes($options['requiredfieldstext']); if (!empty($reqtext)) $content .= '<p id="requiredfieldsmsg"><sup>*</sup>'.$reqtext.'</p>'; $content .= '<div id="salesforce"><small>Powered by <a href="http://www.salesforce.com/">Salesforce CRM</a></small></div>'; return $content; } function submit_salesforce_form($post, $options) { global $wp_version; if (!isset($options['org_id']) || empty($options['org_id'])) return false; $post['oid'] = $options['org_id']; $post['lead_source'] = $options['source']; $post['debug'] = 0; // Set SSL verify to false because of server issues. $args = array( 'body' => $post, 'headers' => array( 'user-agent' => 'WordPress-to-Lead for Salesforce plugin - WordPress/'.$wp_version.';'.get_bloginfo('url'), ), 'sslverify' => false, ); $result = wp_remote_post('https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8', $args); if ($result['headers']['is-processed'] == "true") return true; else return false; } |
If you enjoyed this post,make sure you subscribe to my RSS feed!



[...] Armed [...]