'',
'formhash' => '',
'autoresize' => true,
'height' => '500',
'header' => 'show',
),
$atts
);
// Check username and formhash to ensure they only have alphanumeric characters or underscores, and aren't empty.
if ( ! preg_match( '/^[a-zA-Z0-9_]+$/', $attr['username'] ) || ! preg_match( '/^[a-zA-Z0-9_]+$/', $attr['formhash'] ) ) {
/**
* Return an error to the users with instructions if one of these params is invalid
* They don't have default values because they are user/form-specific
*/
$return_error = sprintf( __( 'Something is wrong with your Wufoo shortcode. If you copy and paste it from the %1$sWufoo Code Manager%2$s, you should be golden.', 'jetpack' ), '', '' );
return '
Uh oh!
' . $return_error . '
';
}
/**
* Placeholder which will tell Wufoo where to render the form.
*/
$js_embed_placeholder = '';
/**
* Required parameters are present.
* An error will be returned inside the form if they are invalid.
*/
$js_embed = '(function(){try{var wufoo_' . $attr['formhash'] . ' = new WufooForm();';
$js_embed .= 'wufoo_' . $attr['formhash'] . '.initialize({';
$js_embed .= "'userName':'" . $attr['username'] . "', ";
$js_embed .= "'formHash':'" . $attr['formhash'] . "', ";
$js_embed .= "'autoResize':" . (bool) ( $attr['autoresize'] ) . ',';
$js_embed .= "'height':'" . (int) $attr['height'] . "',";
$js_embed .= "'header':'" . esc_js( $attr['header'] ) . "',";
$js_embed .= "'ssl':true,'async':true});";
$js_embed .= 'wufoo_' . $attr['formhash'] . '.display();';
$js_embed .= '}catch(e){}})();';
/**
* iframe embed, loaded inside