Example #1
0
 /**
  * Send Confirmation E-mail
  *
  * Send an e-mail to the blog administrator informing
  * them of a form submission.
  *
  * @param string $format - format of email (plain or HTML)
  * @param string $sendto - email address to send content to
  * @param string $results - URL of the spreadsheet which holds submitted data
  */
 static function SendConfirmationEmail($format = WPGFORM_EMAIL_FORMAT_HTML, $sendto = false, $results = null)
 {
     $headers = array();
     $wpgform_options = wpgform_get_plugin_options();
     if ($sendto === false || $sendto === null) {
         $sendto = get_bloginfo('admin_email');
     }
     if ($results === false || $results === null) {
         $results = 'N/A';
     } elseif ($format == WPGFORM_EMAIL_FORMAT_HTML) {
         $results = sprintf('<a href="%s">%s</a>', $results, __('View Form Results', WPGFORM_I18N_DOMAIN));
     }
     if ($format == WPGFORM_EMAIL_FORMAT_HTML) {
         $headers[] = 'MIME-Version: 1.0' . PHP_EOL;
         $headers[] = 'Content-type: text/html; charset=iso-8859-1' . PHP_EOL;
     }
     $headers[] = sprintf("From: %s <%s>", get_bloginfo('name'), $sendto) . PHP_EOL;
     $headers[] = sprintf("Cc: %s", $sendto) . PHP_EOL;
     //  Bcc Blog Admin?
     if ($wpgform_options['bcc_blog_admin']) {
         $headers[] = sprintf("Bcc: %s", get_bloginfo('admin_email')) . PHP_EOL;
     }
     $headers[] = sprintf("Reply-To: %s", $sendto) . PHP_EOL;
     $headers[] = sprintf("X-Mailer: PHP/%s", phpversion());
     if ($format == WPGFORM_EMAIL_FORMAT_HTML) {
         $html = '
             <html>
             <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
             <head>
             <title>%s</title>
             </head>
             <body>
             <p>
             FYI -
             </p>
             <p>
             %s
             <ul>
             <li>%s:  %s</li>
             <li>%s:  %s</li>
             <li>%s:  %s</li>
             <li>%s: %s</li>
             <li>%s: %s</li>
             </ul>
             </p>
             <p>
             %s,<br/><br/>
             %s
             </p>
             </body>
             </html>';
         $message = sprintf($html, get_bloginfo('name'), __('A form was submitted on your web site.', WPGFORM_I18N_DOMAIN), __('Form', WPGFORM_I18N_DOMAIN), get_the_title(), __('URL', WPGFORM_I18N_DOMAIN), get_permalink(), __('Responses', WPGFORM_I18N_DOMAIN), $results, __('Date', WPGFORM_I18N_DOMAIN), current_time('Y-m-d'), __('Time', WPGFORM_I18N_DOMAIN), current_time('H:i'), __('Thank you', WPGFORM_I18N_DOMAIN), get_bloginfo('name'));
     } else {
         $plain = 'FYI -' . PHP_EOL . PHP_EOL;
         $plain .= sprintf('%s:', __('A form was submitted on your web site', WPGFORM_I18N_DOMAIN)) . PHP_EOL . PHP_EOL;
         $plain .= sprintf('%s:', __('Form', WPGFORM_I18N_DOMAIN)) . '  %s' . PHP_EOL;
         $plain .= sprintf('%s:', __('URL', WPGFORM_I18N_DOMAIN)) . '  %s' . PHP_EOL;
         $plain .= sprintf('%s:', __('Responses', WPGFORM_I18N_DOMAIN)) . '  %s' . PHP_EOL;
         $plain .= sprintf('%s:', __('Date', WPGFORM_I18N_DOMAIN)) . '  %s' . PHP_EOL;
         $plain .= sprintf('%s:', __('Time', WPGFORM_I18N_DOMAIN)) . '  %s' . PHP_EOL . PHP_EOL;
         $plain .= sprintf('%s,', __('Thank you', WPGFORM_I18N_DOMAIN)) . PHP_EOL . PHP_EOL . '%s' . PHP_EOL;
         $message = sprintf($plain, get_the_title(), get_permalink(), $results, current_time('Y-m-d'), current_time('H:i'), get_option('blogname'));
     }
     //  TO email address may actually contain multiple addresses.
     //  Need to split the string using semicolon as a delimiter.
     $to = "";
     $sendto = explode(';', $sendto);
     foreach ($sendto as $s) {
         $to .= sprintf('%s wpGForm Contact <%s>', get_option('blogname'), trim($s));
     }
     $subject = sprintf('Form Submission from %s', get_option('blogname'));
     if (WPGFORM_DEBUG) {
         wpgform_preprint_r($headers, htmlentities($message));
     }
     $status = wp_mail($to, $subject, $message, $headers);
     return $status;
 }
/**
 * wpgform_settings_advanced_options()
 *
 * Build the form content and populate with any current plugin settings.
 *
 * @return none
 */
function wpgform_settings_advanced_options()
{
    $wpgform_options = wpgform_get_plugin_options();
    ?>
    <table class="form-table">
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('Disable HTML Filtering', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_disable_html_filtering">
            <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
            <tr>
            <td style="padding: 5px 0px; vertical-align: top;">
            <input name="wpgform_options[disable_html_filtering]" type="checkbox" id="wpgform_disable_html_filtering" value="1" <?php 
    checked('1', $wpgform_options['disable_html_filtering']);
    ?>
 />
            </td>
            <td style="padding: 5px;">
            <?php 
    _e('Disable HTML Filtering?<br/><small>Google Forms filters HTML retrieved from Google using <a href="https://codex.wordpress.org/Function_Reference/wp_kses">wp_kses()</a> to eliminate unnecessary HTML code.</small>', WPGFORM_I18N_DOMAIN);
    ?>
            </td>
            </tr>
            </table>
            </label>
            </fieldset></td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('Enable Form Submission Logging', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_form_submission_log">
            <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
            <tr>
            <td style="padding: 5px 0px; vertical-align: top;">
            <input name="wpgform_options[form_submission_log]" type="checkbox" id="wpgform_form_submission_log" value="1" <?php 
    checked('1', $wpgform_options['form_submission_log']);
    ?>
 />
            </td>
            <td style="padding: 5px;">
            <?php 
    _e('Log WordPress Google Form Submissions?<br/><small>Form submissions can be logged which will track a number of client related metrics upon form submission.</small>', WPGFORM_I18N_DOMAIN);
    ?>
            </td>
            </tr>
            </table>
            </label>
            </fieldset></td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('Google Default Text', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td>
            <fieldset>
            <label for="wpgform_override_google_default_text">
            <input name="wpgform_options[override_google_default_text]" type="checkbox" id="wpgform_override_google_default_text" value="1" <?php 
    checked('1', $wpgform_options['override_google_default_text']);
    ?>
 />
            <?php 
    _e('Override <i><b>Google Default Text</b></i>', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            <br />
            <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
            <tr>
            <th><?php 
    _e('Required', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_required_text_override">
            <input name="wpgform_options[required_text_override]" type="text" id="wpgform_required_text_override" value="<?php 
    echo $wpgform_options['required_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text that indicates a field is required.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            <tr>
            <th><?php 
    _e('Submit Button', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_submit_button_text_override">
            <input name="wpgform_options[submit_button_text_override]" type="text" id="wpgform_submit_button_text_override" value="<?php 
    echo $wpgform_options['submit_button_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text used for the Submit button.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            <tr>
            <th><?php 
    _e('Back Button', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_back_button_text_override">
            <input name="wpgform_options[back_button_text_override]" type="text" id="wpgform_back_button_text_override" value="<?php 
    echo $wpgform_options['back_button_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text used for the Back button.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            <tr>
            <th><?php 
    _e('Continue Button', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_continue_button_text_override">
            <input name="wpgform_options[continue_button_text_override]" type="text" id="wpgform_continue_button_text_override" value="<?php 
    echo $wpgform_options['continue_button_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text used for the Continue button.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            <tr>
            <th><?php 
    _e('Radio Buttons', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_radio_buttons_text_override">
            <input name="wpgform_options[radio_buttons_text_override]" type="text" id="wpgform_radio_buttons_text_override" value="<?php 
    echo $wpgform_options['radio_buttons_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text used for the Radio Buttons hint.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            <tr>
            <th><?php 
    _e('Radio Buttons - Other', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_radio_buttons_other_text_override">
            <input name="wpgform_options[radio_buttons_other_text_override]" type="text" id="wpgform_radio_buttons_other_text_override" value="<?php 
    echo $wpgform_options['radio_buttons_other_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text used for the Radio Buttons Other option.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            <tr>
            <th><?php 
    _e('Check Boxes', WPGFORM_I18N_DOMAIN);
    ?>
</th>
            <td>
            <label for="wpgform_check_boxes_text_override">
            <input name="wpgform_options[check_boxes_text_override]" type="text" id="wpgform_check_boxes_text_override" value="<?php 
    echo $wpgform_options['check_boxes_text_override'];
    ?>
" /><br />
           <small><?php 
    _e('This is text used for the Check Boxes hint.', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </td>
            </tr>
            </table>
            </fieldset></td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('HTTP API Timeout', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_http_api_timeout">
            <select style="width: 150px;" name="wpgform_options[http_api_timeout]" id="wpgform_http_api_timeout">
            <option value="5" <?php 
    selected($wpgform_options['http_api_timeout'], 5);
    ?>
>5 Seconds</option>
            <option value="10" <?php 
    selected($wpgform_options['http_api_timeout'], 10);
    ?>
>10 Seconds</option>
            <option value="15" <?php 
    selected($wpgform_options['http_api_timeout'], 15);
    ?>
>15 Seconds</option>
            <option value="25" <?php 
    selected($wpgform_options['http_api_timeout'], 25);
    ?>
>25 Seconds</option>
            <option value="30" <?php 
    selected($wpgform_options['http_api_timeout'], 30);
    ?>
>30 Seconds</option>
            <option value="45" <?php 
    selected($wpgform_options['http_api_timeout'], 45);
    ?>
>45 Seconds</option>
            <option value="60" <?php 
    selected($wpgform_options['http_api_timeout'], 60);
    ?>
>60 Seconds</option>
            </select>
            <br />
            <small><?php 
    _e('Change the default HTTP API Timeout setting (default is 5 seconds).', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </fieldset></td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('Browser Check', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_browser_check">
            <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
            <tr>
            <td style="padding: 5px 0px; vertical-align: top;">
            <input name="wpgform_options[browser_check]" type="checkbox" id="wpgform_browser_check" value="1" <?php 
    checked('1', $wpgform_options['browser_check']);
    ?>
 />
            </td>
            <td style="padding: 5px;">
            <?php 
    _e('Check browser compatibility?<br/><small>The WordPress Google Form plugin may not work as expected with older browser versions (e.g. IE6, IE7, etc.).</small>', WPGFORM_I18N_DOMAIN);
    ?>
            </td>
            </tr>
            </table>
            </label>
            </fieldset></td>
        </tr>
        <tr valign="top">
        <th scope="row"><label><?php 
    _e('Enable Debug', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_enable_debug">
            <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
            <tr>
            <td style="padding: 5px 0px; vertical-align: top;">
            <input name="wpgform_options[enable_debug]" type="checkbox" id="wpgform_enable_debug" value="1" <?php 
    checked('1', $wpgform_options['enable_debug']);
    ?>
 />
            </td>
            <td style="padding: 5px;">
            <?php 
    printf(__('Enabling debug will collect data during the form rendering and processing process.<p>The data is added to the page footer but hidden with a link appearing above the form which can toggle the display of the debug data.  This data is useful when trying to understand why the plugin isn\'t operating as expected.</p><p>When debugging is enabled, specific transports employed by the <a href="%s">WordPress HTTP API</a> can optionally be disabled.  While rarely required, disabling transports can be useful when the plugin is not communcating correctly with the Google Docs API.  <i>Extra care should be taken when disabling transports as other aspects of WordPress may not work correctly.</i>  The <a href="%s">WordPress Core Control</a> plugin is recommended for advanced debugging of <a href="%s">WordPress HTTP API issues.</a></p>', WPGFORM_I18N_DOMAIN), 'http://codex.wordpress.org/HTTP_API', 'http://wordpress.org/extend/plugins/core-control/', 'http://codex.wordpress.org/HTTP_API');
    ?>
            </td>
            </tr>
            </table>
            </label>
            </fieldset></td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('WordPress HTTP API<br/>Transport Control', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_fsockopen_transport">
            <input name="wpgform_options[fsockopen_transport]" type="checkbox" id="wpgform_fsockopen_transport" value="1" <?php 
    checked('1', $wpgform_options['fsockopen_transport']);
    ?>
 />
            <?php 
    _e('Disable <i><b>FSockOpen</b></i> Transport', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            <br />
            <label for="wpgform_streams_transport">
            <input name="wpgform_options[streams_transport]" type="checkbox" id="wpgform_streams_transport" value="1" <?php 
    checked('1', $wpgform_options['streams_transport']);
    ?>
 />
            <?php 
    _e('Disable <i><b>Streams</b></i> Transport', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            <br />
            <label for="wpgform_curl_transport">
            <input name="wpgform_options[curl_transport]" type="checkbox" id="wpgform_curl_transport" value="1" <?php 
    checked('1', $wpgform_options['curl_transport']);
    ?>
 />
            <?php 
    _e('Disable <i><b>cURL</b></i> Transport', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            <br />
            <label for="wpgform_ssl_verify">
            <input name="wpgform_options[ssl_verify]" type="checkbox" id="wpgform_ssl_verify" value="1" <?php 
    checked('1', $wpgform_options['ssl_verify']);
    ?>
 />
            <?php 
    _e('Disable <i><b>SSL Verify</b></i>', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            <br />
            <label for="wpgform_local_ssl_verify">
            <input name="wpgform_options[local_ssl_verify]" type="checkbox" id="wpgform_local_ssl_verify" value="1" <?php 
    checked('1', $wpgform_options['local_ssl_verify']);
    ?>
 />
            <?php 
    _e('Disable <i><b>Local SSL Verify</b></i>', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            </fieldset></td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
    _e('HTTP Request Timeout', WPGFORM_I18N_DOMAIN);
    ?>
</label></th>
            <td><fieldset>
            <label for="wpgform_http_request_timeout">
            <input name="wpgform_options[http_request_timeout]" type="checkbox" id="wpgform_http_request_timeout" value="1" <?php 
    checked('1', $wpgform_options['http_request_timeout']);
    ?>
 />
            <?php 
    _e('Change <i><b>HTTP Request Timeout</b></i>', WPGFORM_I18N_DOMAIN);
    ?>
</label>
            <br />
            <label for="wpgform_http_request_timeout_value">
            <input name="wpgform_options[http_request_timeout_value]" type="text" id="wpgform_http_request_timeout_value" value="<?php 
    echo $wpgform_options['http_request_timeout_value'];
    ?>
" /><br />
           <small><?php 
    _e('(in seconds)', WPGFORM_I18N_DOMAIN);
    ?>
</small></label>
            </fieldset></td>
        </tr>
    </table>
    <br /><br />
    <input name="wpgform_options[sc_posts]" type="hidden" id="wpgform_sc_posts" value="<?php 
    echo $wpgform_options['sc_posts'];
    ?>
" />
    <input name="wpgform_options[sc_widgets]" type="hidden" id="wpgform_sc_widgets" value="<?php 
    echo $wpgform_options['sc_widgets'];
    ?>
" />
    <input name="wpgform_options[default_css]" type="hidden" id="wpgform_default_css" value="<?php 
    echo $wpgform_options['default_css'];
    ?>
" />
    <input name="wpgform_options[custom_css]" type="hidden" id="wpgform_custom_css" value="<?php 
    echo $wpgform_options['custom_css'];
    ?>
" />
    <input name="wpgform_options[custom_css_styles]" type="hidden" id="wpgform_custom_css_styles" value="<?php 
    echo $wpgform_options['custom_css_styles'];
    ?>
" />
    <input name="wpgform_options[donation_message]" type="hidden" id="wpgform_donation_message" value="<?php 
    echo $wpgform_options['donation_message'];
    ?>
" />
    <input name="wpgform_options[captcha_terms]" type="hidden" id="wpgform_captcha_terms" value="<?php 
    echo $wpgform_options['captcha_terms'];
    ?>
" />
    <input name="wpgform_options[captcha_operator_plus]" type="hidden" id="wpgform_captcha_operator_plus" value="<?php 
    echo $wpgform_options['captcha_operator_plus'];
    ?>
" />
    <input name="wpgform_options[captcha_operator_minus]" type="hidden" id="wpgform_captcha_operator_minus" value="<?php 
    echo $wpgform_options['captcha_operator_minus'];
    ?>
" />
    <input name="wpgform_options[captcha_operator_mult]" type="hidden" id="wpgform_captcha_operator_mult" value="<?php 
    echo $wpgform_options['captcha_operator_mult'];
    ?>
" />
    <input name="wpgform_options[email_format]" type="hidden" id="wpgform_email_format" value="<?php 
    echo $wpgform_options['email_format'];
    ?>
" />
    <input name="wpgform_options[serialize_post_vars]" type="hidden" id="wpgform_serialize_post_vars" value="<?php 
    echo $wpgform_options['serialize_post_vars'];
    ?>
" />
    <input name="wpgform_options[bcc_blog_admin]" type="hidden" id="wpgform_bcc_blog_admin" value="<?php 
    echo $wpgform_options['bcc_blog_admin'];
    ?>
" />
<?php 
}