function emma_form_shortcode($atts)
{
    $account_settings_options = get_option('emma_account_information');
    $atts = shortcode_atts(array('signup_form_id' => $account_settings_options['group_active'], 'signup_form_layout' => ''), $atts, 'emma_form');
    // call the dynamic stylesheet
    $emma_style = new Emma_Style();
    // dump it in the footer.
    add_action('wp_footer', array($emma_style, 'output'), 10);
    // Check to make sure we're signed in, otherwise display an alert
    if ($account_settings_options['logged_in'] == 'true') {
        $emma_form = new Emma_Form();
        $emma_form->signup_form_id = $atts['signup_form_id'];
        $emma_form->signup_form_layout = $atts['signup_form_layout'];
        $returned = $emma_form->generate_form();
    } else {
        // Only show the warning if the user is logged in
        if (current_user_can('manage_options')) {
            $account_settings_options = get_option('emma_account_information');
            $returned .= '<p class="emma-alert">You need to sign into your Emma account before we can display your form!</p>';
        }
    }
    // this just cracks me up.
    return $returned;
}
 function widget($args, $instance)
 {
     extract($args);
     // generate widget markup
     echo $before_widget;
     // load up the widget settings
     $title = apply_filters('widget_title', $instance['title']);
     // check if there's a title, and display it.
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $title) . $after_title;
     }
     // instantiate form class, pass in plugin settings
     $emma_form = new Emma_Form();
     $account_settings_options = get_option('emma_account_information');
     if ($account_settings_options['logged_in'] == 'true') {
         // hey crazy, if a function returns something, you'll need to echo it out.
         echo $emma_form->generate_form();
     } else {
         // Only show the warning if the user is logged in
         if (current_user_can('manage_options')) {
             $account_settings_options = get_option('emma_account_information');
             echo '<p class="emma-alert">You need to sign into your Emma account before we can display your form!</p>';
         }
     }
     // end of widget output
     echo $after_widget;
 }
function emma_ajax_form_submit_callback()
{
    $emma_form = new Emma_Form();
    $emma_form->generate_form($_POST);
    $status_text = $emma_form->status_txt;
    $response = $emma_form->emma_response;
    $response_array = array('status_txt' => $status_text, 'code' => $response, 'raw_data' => $emma_form->raw_data, 'raw_response' => $emma_form->raw_response);
    echo json_encode($response_array);
    wp_die();
}