Skip to content

Instantly share code, notes, and snippets.

@wufoo
wufoo / SendEmailwFileAttachment.php
Created March 28, 2011 17:50
For use with Wufoo WebHook
<?php
// NOTE: it's best practice to CLEAN YOUR INPUTS
// http://www.acunetix.com/websitesecurity/php-security-1.htm
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
<?php if ($_GET['results']) { ?>
<!-- Embed results here -->
<?php } else { ?>
<!-- Embed form here -->
<?php } ?>
@wufoo
wufoo / sendEmail.php
Created March 22, 2011 19:39
Send Email
<?php
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
@wufoo
wufoo / Easiest Example Possible.html
Created February 22, 2011 14:13
Easiest possible example of the Wufoo Form Embed Kit
<html>
<body>
<div id="popup"></div>
<script src="http://wufoo.com/scripts/iframe/formEmbedKit.js"></script>
<script>
var framework = WufooFormEmbedKit(userDefinedCallback, 'popup', 'yourPoviderIdentifier');
framework.initialize();
function userDefinedCallback(message) {
alert(message);
framework.destroy();
@wufoo
wufoo / Return Value.JSON
Created February 21, 2011 23:44
JSON return from the Wufoo Form Embed Kit
{
"setup":"<script type=\"text\/javascript\">var host = ((\"https:\" == document.location.protocol) ? \"https:\/\/secure.\" : \"http:\/\/\");document.write(unescape(\"%3Cscript src='\" + host + \"wufoo.com\/scripts\/embed\/iframe.js' type='text\/javascript'%3E%3C\/script%3E\"));<\/script>",
"display":"<script type=\"text\/javascript\">\nvar z7x4a9 = new WufooForm();\nz7x4a9.initialize({\n'userName':'wufooapi', \n'formHash':'z7x4a9', \n'autoResize':true,\n'height':'627',\n'ssl':true});\nz7x4a9.display();\n<\/script>"
}
@wufoo
wufoo / userDefinedCallback.js
Created February 21, 2011 23:27
User Defined Callback for the Wufoo Form Embed Kit
function userDefinedCallback(message, transport) {
//FIG. 10 Close lightbox
$("#popup").fadeOut();
// FIG. 11: MAGIC: Receive code from wufoo.com
var objMessage = jQuery.parseJSON(message);
// FIG. 12: Create div and write out code for preview
// You wouldn't necessarily need to preview, you can do whatever you want with the code
$('<div />', {
@wufoo
wufoo / framework.js
Created February 21, 2011 23:16
Defining the function for the Wufoo Form Embed Kit
var framework = WufooFormEmbedKit(userDefinedCallback, 'popup', 'yourPoviderIdentifier');
@wufoo
wufoo / Script Tags.html
Created February 21, 2011 22:58
js file includes for the Wufoo Form Embed Kit
<!-- FIG. 4 - The Wufoo Form Embed Kit -->
<script src="//wufoo.com/scripts/iframe/formEmbedKit.js"></script>
<!-- FIG. 5 jQuery NOT REQUIRED, just used here for funzies -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<!-- FIG. 6 opening and closing of iframe in popup -->
<script src="//wufoo.com/scripts/iframe/example/example.js"></script>
<!-- FIG. 7: only required if previewing the form for the user -->
@wufoo
wufoo / FormEmbedKitExample.html
Created February 21, 2011 22:33
Example of the Wufoo Form Embed Kit
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Wufoo Form Integration &middot; Test</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@wufoo
wufoo / hi.js
Created February 21, 2011 22:20
this is cool!
var x = '1';