/**
 * Debug action to examine server variables
 *
 */
function wpgform_debug()
{
    global $wp_filter;
    wpgform_error_log($_POST);
    if (!is_admin()) {
        wpgform_whereami(__FILE__, __LINE__, '$_SERVER');
        wpgform_preprint_r($_SERVER);
        wpgform_whereami(__FILE__, __LINE__, '$_ENV');
        wpgform_preprint_r($_ENV);
        wpgform_whereami(__FILE__, __LINE__, '$_POST');
        wpgform_preprint_r($_POST);
        wpgform_whereami(__FILE__, __LINE__, '$_GET');
        wpgform_preprint_r($_GET);
        wpgform_whereami(__FILE__, __LINE__, 'locale');
        wpgform_preprint_r(get_locale());
        wpgform_preprint_r(setlocale(LC_ALL, NULL));
        if (array_key_exists('init', $wp_filter)) {
            wpgform_whereami(__FILE__, __LINE__, '$wp_filter[\'init\']');
            wpgform_preprint_r($wp_filter['init']);
        }
        if (array_key_exists('template_redirect', $wp_filter)) {
            wpgform_whereami(__FILE__, __LINE__, '$wp_filter[\'template_redirect\']');
            wpgform_preprint_r($wp_filter['template_redirect']);
        }
    }
}
Exemple #2
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;
 }