Google Forms - Version 0.27

Version Description

No known upgrade issues.

Download this release

Release Info

Developer mpwalsh8
Plugin Icon wp plugin Google Forms
Version 0.27
Comparing to
See all releases

Code changes from version 0.26 to 0.27

Files changed (5) hide show
  1. gforms.css +23 -0
  2. index.php +2 -2
  3. readme.txt +19 -7
  4. wpgform-core.php +53 -47
  5. wpgform-options.php +27 -1
gforms.css CHANGED
@@ -13,6 +13,29 @@ label.gform-error {
13
  color: red;
14
  font-weight: bold;
15
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  body.ss-base-body {}
17
  div.errorbox-good {}
18
  div.ss-attribution {}
13
  color: red;
14
  font-weight: bold;
15
  }
16
+
17
+ div.gform-google-error,
18
+ div.gform-browser-warning,
19
+ div.gform-browser-error {
20
+ -webkit-border-radius: 3px;
21
+ border-radius: 3px;
22
+ border-width: 1px;
23
+ border-style: solid;
24
+ padding: 0 .6em;
25
+ margin: 5px 0 15px;
26
+ }
27
+
28
+ div.gform-browser-warning {
29
+ background-color: #ffffe0;
30
+ border-color: #e6db55;
31
+ }
32
+
33
+ div.gform-google-error,
34
+ div.gform-browser-error {
35
+ background-color: #ffebe8;
36
+ border-color: #cc0000;
37
+ }
38
+
39
  body.ss-base-body {}
40
  div.errorbox-good {}
41
  div.ss-attribution {}
index.php CHANGED
@@ -4,8 +4,8 @@
4
  * Plugin Name: WordPress Google Form
5
  * Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
6
  * Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
7
- * Version: 0.26
8
- * Build: 0.26.$WCREV$
9
  * Last Modified: $WCDATE$
10
  * Author: Mike Walsh
11
  * Author URI: http://www.michaelwalsh.org
4
  * Plugin Name: WordPress Google Form
5
  * Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
6
  * Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
7
+ * Version: 0.27
8
+ * Build: 0.27.$WCREV$
9
  * Last Modified: $WCDATE$
10
  * Author: Mike Walsh
11
  * Author URI: http://www.michaelwalsh.org
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
5
  Requires at least: 3.0
6
  Tested up to: 3.3.1
7
- Stable tag: 0.26
8
 
9
  Embeds a published, public Google Form in a WordPress post, page, or widget.
10
 
@@ -31,10 +31,11 @@ Currently, this plugin only supports Google Forms that are "Published as a web p
31
 
32
  The WordPress Google Form shortcode `gform` supports a number of attributes that allow further control and customization of the Google Form.
33
 
34
- `[gform form='<full_url_to_Google_Form>' confirm='<full_url_to_confirmation_page>' class='<value>' legal='on|off' br='on|off' prefix='<value>' suffix='<value>']`
35
 
36
  * __form__: The full URL to the published Google Form. You must be able to open this URL successfully from a browser for the __gform__ shortcode to work properly.
37
- * __confirm__: A full URL to the confirmation (e.g. _Thanks for your submission!_) page. Be default Google displays a very basic confirmation page which cannot be integrated easily with your WordPress site. The _confirm_ attribute allows the form submission to land on a page of your choosing. **It is strongly encouraged that you make use of a confirmation page.** It will make the form submission process cleaner and clearer to the end user.
 
38
  * __alert__: A message to display upon successful form submission in a Javascript Alert box (e.g. _Thanks for your submission!_).
39
  * __class__: Google Forms are full of classes but the WordPress Google Form plugin does not bring their definitions into page when importing the form. The _class_ attribute allows the addition of one or more CSS classes to the DIV which wraps the Google Form. To add multiple classes, simply separate the class names with spaces.
40
  * __legal__: By default Google Forms have a _Powered by Google Docs_ section at the bottom of the form which includes links to Google TOS and other Google information. If you do not want to see this information as part of the form, add `legal='off'` to your shortcode usage. The content remains in the form, it is simply hidden from the end user using CSS.
@@ -43,8 +44,9 @@ The WordPress Google Form shortcode `gform` supports a number of attributes that
43
  * __suffix__: Append a character string to the end of each form label. This can also be accomplished using CSS, refer to the CSS section.
44
  * __title__: By default Google Forms have title wrapped in a &lt;h1&gt; tag. If you do not want to include this form title as part of the form, add `title='off'` to your shortcode usage. The &lt;h1&gt; content is removed from the form.
45
  * __maph1h2__: By default Google Forms have title wrapped in a &lt;h1&gt; tag. If you want the form title but not as an &lt;h1&gt; element, add `maph1h2='on'` to your shortcode usage. The &lt;h1&gt; elements will be mapped to &lt;h2&gt; elements. The CSS class attributes remain unchanged.
 
46
 
47
- `[gform form='https://docs.google.com/spreadsheet/viewform?hl=en_US&pli=1&formkey=ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678#gid=0' confirm='http://www.example.com/thankyou/' class='mygform' legal='off' prefix='mygform-' br='on' title='on' maph1h2='on']`
48
 
49
  == Frequently Asked Questions ==
50
 
@@ -82,6 +84,9 @@ label.ss-q-title:after {
82
  = No matter what I do, I always get the "Unable to retrieve Google Form. Please try reloading this page." error message. Why is this? =
83
  Validate that the WordPress HTTP API is working correctly. If you are seeing HTTP API errors on the WordPress Dashboard or when you attempt to access the plugin repository through the Dashboard, the WordPress Google Form will likely fail too. It requires the WordPress HTTP API to be working. With some free hosting plans, ISPs disable the ability to access remote content.
84
 
 
 
 
85
  == CSS ==
86
 
87
  As of 2011-09-21, Google Forms make use of 20+ CSS class definitions. By default, the WordPress Google Form plugin includes CSS declarations for all of the classes however the bulk of them are empty. The default CSS sets the font and makes the entry boxes wider. The default CSS that ships with WordPress Google Form can optionally be turned off via the WordPress Google Form settings.
@@ -177,16 +182,23 @@ No known upgrade issues.
177
 
178
  == Changelog ==
179
 
 
 
 
 
 
 
 
180
  = Version 0.26 =
181
- * Added new shortcode attribute "email='on|off'", default is 'off'.
182
- * Changed confirmation page from a hard redirect to a Ajax load.
183
  * Added new email format choice on the Options page, default is HTML.
184
  * Cleaned up some dead code and comments.
185
 
186
  = Version 0.25 =
187
  * Fixed problem with checkbox processing when using the prefix attribute.
188
  * Fixed problem with hiding legal links when using the prefix attribute.
189
- * Fixed problem with legal='off' attribute not being processed correctly.
190
 
191
  = Version 0.24 =
192
  * Fixed minor typos and other assorted nits.
4
  Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
5
  Requires at least: 3.0
6
  Tested up to: 3.3.1
7
+ Stable tag: 0.27
8
 
9
  Embeds a published, public Google Form in a WordPress post, page, or widget.
10
 
31
 
32
  The WordPress Google Form shortcode `gform` supports a number of attributes that allow further control and customization of the Google Form.
33
 
34
+ `[gform form='<full_url_to_Google_Form>' confirm='<full_url_to_confirmation_page>' class='<value>' legal='on|off' br='on|off' prefix='<value>' suffix='<value>' email='on|off' style='redirect|ajax']`
35
 
36
  * __form__: The full URL to the published Google Form. You must be able to open this URL successfully from a browser for the __gform__ shortcode to work properly.
37
+ * __confirm__: A full URL to the confirmation (e.g. _Thanks for your submission!_) page. Be default Google displays a very basic confirmation page which cannot be integrated easily with your WordPress site. The _confirm_ attribute allows the form submission to land on a page of your choosing. **It is strongly encouraged that you make use of a confirmation page.** It will make the form submission process cleaner and clearer to the end user. The confirmation page will be displayed by a page redirect unless a different behavior is specified using the __style__ attribute.
38
+ * __style__: Specify how the custom confirmation page should be presented. Legal values for the __style__ attribute are __redirect__ and __ajax__ (e.g. __style='redirect'__ or __style='ajax'__).
39
  * __alert__: A message to display upon successful form submission in a Javascript Alert box (e.g. _Thanks for your submission!_).
40
  * __class__: Google Forms are full of classes but the WordPress Google Form plugin does not bring their definitions into page when importing the form. The _class_ attribute allows the addition of one or more CSS classes to the DIV which wraps the Google Form. To add multiple classes, simply separate the class names with spaces.
41
  * __legal__: By default Google Forms have a _Powered by Google Docs_ section at the bottom of the form which includes links to Google TOS and other Google information. If you do not want to see this information as part of the form, add `legal='off'` to your shortcode usage. The content remains in the form, it is simply hidden from the end user using CSS.
44
  * __suffix__: Append a character string to the end of each form label. This can also be accomplished using CSS, refer to the CSS section.
45
  * __title__: By default Google Forms have title wrapped in a &lt;h1&gt; tag. If you do not want to include this form title as part of the form, add `title='off'` to your shortcode usage. The &lt;h1&gt; content is removed from the form.
46
  * __maph1h2__: By default Google Forms have title wrapped in a &lt;h1&gt; tag. If you want the form title but not as an &lt;h1&gt; element, add `maph1h2='on'` to your shortcode usage. The &lt;h1&gt; elements will be mapped to &lt;h2&gt; elements. The CSS class attributes remain unchanged.
47
+ * __email__: Notify the site's WordPress administrator that a form has been submitted by setting the __email__ attribute to __on__. This will result in an email being sent to the blog administrator letting them know a form was submitted with the URL of the form along with the date and time of submission.
48
 
49
+ `[gform form='https://docs.google.com/spreadsheet/viewform?hl=en_US&pli=1&formkey=ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678#gid=0' confirm='http://www.example.com/thankyou/' style='ajax' class='mygform' legal='off' prefix='mygform-' br='on' title='on' maph1h2='on' email='on']`
50
 
51
  == Frequently Asked Questions ==
52
 
84
  = No matter what I do, I always get the "Unable to retrieve Google Form. Please try reloading this page." error message. Why is this? =
85
  Validate that the WordPress HTTP API is working correctly. If you are seeing HTTP API errors on the WordPress Dashboard or when you attempt to access the plugin repository through the Dashboard, the WordPress Google Form will likely fail too. It requires the WordPress HTTP API to be working. With some free hosting plans, ISPs disable the ability to access remote content.
86
 
87
+ = I don't like the redirection behavior of the custom confirmation, can you change it back to the way it worked in v0.10? =
88
+ Unfortunately not. I understand that the older behavior is preferable as it looks cleaner for the end user however there is no way to support multi-page Google Forms using the old model. The requirement to support multi-page Google Forms is a higher priority than the older confirmation model based on the overwhelming feedback received to support multi-page forms. In v0.26 a new confirmation behavior was introduced which uses AJAX to update the page with the content from the custom confirmation page. In v0.27 the redirection mechanism has returned to be the default behavior but if the AJAX methodology is preferred, it is available by setting the `style='ajax'` attribute within the shortcode.
89
+
90
  == CSS ==
91
 
92
  As of 2011-09-21, Google Forms make use of 20+ CSS class definitions. By default, the WordPress Google Form plugin includes CSS declarations for all of the classes however the bulk of them are empty. The default CSS sets the font and makes the entry boxes wider. The default CSS that ships with WordPress Google Form can optionally be turned off via the WordPress Google Form settings.
182
 
183
  == Changelog ==
184
 
185
+ = Version 0.27 =
186
+ * Added ability to check and warn for old and/or unsupported browsers. There is an option on the WordPress Google Form settings page to enable this check. When an old or unsupported browser is detected, a message will be displayed on top of the form. The browser check is based on the same functionality that WordPress uses on the Dashboard.
187
+ * Changed default custom confirmation behaviour has reverted back to using a javascript redirect as it did from v0.11 through v0.25.
188
+ * Added new shortcode attribute, __style__, to control how confirmation pages should be handled. There are two options: __style='redirect'__ which is the default and __style='ajax'__ which loads the page content via AJAX.
189
+ * Added new CSS classes to support errors and warnings for the browser check and the inability to load Google Forms.
190
+ * Cleaned up Options page GUI.
191
+
192
  = Version 0.26 =
193
+ * Added new shortcode attribute __email='on|off'__, the default setting is 'off'.
194
+ * Changed confirmation page from a hard redirect to an AJAX page load.
195
  * Added new email format choice on the Options page, default is HTML.
196
  * Cleaned up some dead code and comments.
197
 
198
  = Version 0.25 =
199
  * Fixed problem with checkbox processing when using the prefix attribute.
200
  * Fixed problem with hiding legal links when using the prefix attribute.
201
+ * Fixed problem with __legal='off'__ attribute not being processed correctly.
202
 
203
  = Version 0.24 =
204
  * Fixed minor typos and other assorted nits.
wpgform-core.php CHANGED
@@ -20,6 +20,9 @@
20
  define('WPGFORM_PATH', WP_PLUGIN_DIR.'/'.dirname(plugin_basename(__FILE__))) ;
21
  define('WPGFORM_EMAIL_FORMAT_HTML', 'html') ;
22
  define('WPGFORM_EMAIL_FORMAT_PLAIN', 'plain') ;
 
 
 
23
 
24
  /**
25
  * wpgform_init()
@@ -56,6 +59,7 @@ function wpgform_get_default_plugin_options()
56
  ,'custom_css_styles' => ''
57
  ,'donation_message' => 0
58
  ,'email_format' => WPGFORM_EMAIL_FORMAT_PLAIN
 
59
  ) ;
60
 
61
  return apply_filters('wpgform_default_plugin_options', $default_plugin_options) ;
@@ -142,6 +146,7 @@ function wpgform_register_activation_hook()
142
  ,'custom_css_styles' => ''
143
  ,'donation_message' => 0
144
  ,'email_format' => WPGFORM_EMAIL_FORMAT_PLAIN
 
145
  ) ;
146
 
147
  add_option('wpgform_options', $default_wpgform_options) ;
@@ -259,6 +264,9 @@ class wpGForm
259
  // Should email confirmation be sent?
260
  $email = $options['email'] === 'on' ;
261
 
 
 
 
262
  // WordPress converts all of the ampersand characters to their
263
  // appropriate HTML entity or some variety of it. Need to undo
264
  // that so the URL can be actually be used.
@@ -307,6 +315,7 @@ class wpGForm
307
  }
308
  // Remove the action from the form and POST it
309
 
 
310
  $form = str_replace($action, 'action=""', $form) ;
311
 
312
  $response = wp_remote_post($action,
@@ -321,7 +330,7 @@ class wpGForm
321
  // Retrieve the HTML from the URL
322
 
323
  if (is_wp_error($response))
324
- return '<div class="gform-error">Unable to retrieve Google Form. Please try reloading this page.</div>' ;
325
  else
326
  $html = $response['body'] ;
327
 
@@ -377,8 +386,7 @@ class wpGForm
377
 
378
  if ($first_div === false)
379
  {
380
- print "<pre>$html</pre>" ;
381
- return '<div class="gform-error">Unexpected content encountered, unable to retrieve Google Form.</div>' ;
382
  }
383
 
384
  // Strip off anything prior to the first DIV, we don't want it.
@@ -440,6 +448,7 @@ class wpGForm
440
  $action = $matches[0][$i] ;
441
  }
442
 
 
443
  $html = str_replace($action, 'action=""', $html) ;
444
  $action = preg_replace('/^action/i', 'value', $action) ;
445
 
@@ -455,7 +464,7 @@ class wpGForm
455
 
456
  $wpgform_options = wpgform_get_plugin_options() ;
457
 
458
- if ($wpgform_options['custom_css'] == 1)
459
  $css = '<style>' . $wpgform_options['custom_css_styles'] . '</style>' ;
460
  else
461
  $css = '' ;
@@ -481,52 +490,51 @@ jQuery(document).ready(function($) {
481
  if ($posted && is_null($action) && !is_null($alert))
482
  $js .= PHP_EOL . 'alert("' . $alert . '") ;' ;
483
 
484
- // Load the confirmation URL via Ajax?
485
- if ($posted && is_null($action) && !is_null($confirm))
486
  $js .= PHP_EOL . '$("body").load("' . $confirm . '") ;' ;
487
 
488
- //if ($posted && is_null($action) && !is_null($confirm))
489
- //$js .= PHP_EOL . 'window.location.replace("' . $confirm . '") ;' ;
 
 
490
 
491
  $js .= '
492
  });
493
  </script>
494
  ' ;
495
 
496
- //printf('<h3>%s::%s</h3>', basename(__FILE__), __LINE__) ;
497
  // Send email?
498
  if ($posted && is_null($action) && $email)
499
  {
500
- //printf('<h3>%s::%s</h3>', basename(__FILE__), __LINE__) ;
501
  wpGForm::SendConfirmationEmail($wpgform_options['email_format']) ;
502
  }
503
- //printf('<h3>%s::%s</h3>', basename(__FILE__), __LINE__) ;
504
-
505
- return $js . $css . $html ;
506
- }
507
 
508
- /**
509
- * Get Page URL
510
- *
511
- * @return string
512
- */
513
- function GetPageURL()
514
- {
515
- $pageURL = 'http' ;
516
 
517
- if ($_SERVER["HTTPS"] == "on") $pageURL .= 's' ;
 
 
 
 
518
 
519
- $pageURL .= '://' ;
520
 
521
- if ($_SERVER['SERVER_PORT'] != '80')
522
- $pageURL .= $_SERVER['SERVER_NAME'] .
523
- ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] ;
524
- else
525
- $pageURL .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ;
 
 
 
 
 
526
 
527
- return $pageURL ;
528
  }
529
-
530
  /**
531
  * WordPress Shortcode handler.
532
  *
@@ -534,18 +542,19 @@ jQuery(document).ready(function($) {
534
  */
535
  function RenderGForm($atts) {
536
  $params = shortcode_atts(array(
537
- 'form' => false, // Google Form URL
538
- 'confirm' => false, // Custom confirmation page URL to redirect to
539
- 'alert' => null, // Optional Alert Message
540
- 'class' => 'gform', // Container element's custom class value
541
- 'legal' => 'on', // Display Google Legal Stuff
542
- 'br' => 'off', // Insert <br> tags between labels and inputs
543
- 'suffix' => null, // Add suffix character(s) to all labels
544
- 'prefix' => null, // Add suffix character(s) to all labels
545
- 'readonly' => 'off', // Set all form elements to disabled
546
- 'title' => 'on', // Remove the H1 element(s) from the Form
547
- 'maph1h2' => 'off', // Map H1 element(s) on the form to H2 element(s)
548
- 'email' => 'off' // Send an email confirmation to blog admin on submission
 
549
  ), $atts) ;
550
 
551
  return wpGForm::ConstructGForm($params) ;
@@ -559,7 +568,7 @@ jQuery(document).ready(function($) {
559
  *
560
  * @param string $action - action to take, register or unregister
561
  */
562
- function SendConfirmationEmail($mode = WPGFORM_EMAIL_FORMAT_PLAIN)
563
  {
564
  if ($mode == WPGFORM_EMAIL_FORMAT_HTML)
565
  {
@@ -628,9 +637,6 @@ jQuery(document).ready(function($) {
628
 
629
  $subject = sprintf('Form Submission from %s', get_option('blogname')) ;
630
 
631
- //print '<pre>' ;
632
- //var_dump($to, $subject, $message, $headers) ;
633
- //print '</pre>' ;
634
  $status = wp_mail($to, $subject, $message, $headers) ;
635
 
636
  return $status ;
20
  define('WPGFORM_PATH', WP_PLUGIN_DIR.'/'.dirname(plugin_basename(__FILE__))) ;
21
  define('WPGFORM_EMAIL_FORMAT_HTML', 'html') ;
22
  define('WPGFORM_EMAIL_FORMAT_PLAIN', 'plain') ;
23
+ define('WPGFORM_CONFIRM_AJAX', 'ajax') ;
24
+ define('WPGFORM_CONFIRM_LIGHTBOX', 'lightbox') ;
25
+ define('WPGFORM_CONFIRM_REDIRECT', 'redirect') ;
26
 
27
  /**
28
  * wpgform_init()
59
  ,'custom_css_styles' => ''
60
  ,'donation_message' => 0
61
  ,'email_format' => WPGFORM_EMAIL_FORMAT_PLAIN
62
+ ,'browser_check' => 0
63
  ) ;
64
 
65
  return apply_filters('wpgform_default_plugin_options', $default_plugin_options) ;
146
  ,'custom_css_styles' => ''
147
  ,'donation_message' => 0
148
  ,'email_format' => WPGFORM_EMAIL_FORMAT_PLAIN
149
+ ,'browser_check' => 0
150
  ) ;
151
 
152
  add_option('wpgform_options', $default_wpgform_options) ;
264
  // Should email confirmation be sent?
265
  $email = $options['email'] === 'on' ;
266
 
267
+ // Show the custom confirmation via AJAX instead of redirect?
268
+ $style = $options['style'] ;
269
+
270
  // WordPress converts all of the ampersand characters to their
271
  // appropriate HTML entity or some variety of it. Need to undo
272
  // that so the URL can be actually be used.
315
  }
316
  // Remove the action from the form and POST it
317
 
318
+ //$form = str_replace($action, 'action="' . get_permalink(get_the_ID()) . '"', $form) ;
319
  $form = str_replace($action, 'action=""', $form) ;
320
 
321
  $response = wp_remote_post($action,
330
  // Retrieve the HTML from the URL
331
 
332
  if (is_wp_error($response))
333
+ return '<div class="gform-google-error">Unable to retrieve Google Form. Please try reloading this page.</div>' ;
334
  else
335
  $html = $response['body'] ;
336
 
386
 
387
  if ($first_div === false)
388
  {
389
+ return '<div class="gform-google-error">Unexpected content encountered, unable to retrieve Google Form.</div>' ;
 
390
  }
391
 
392
  // Strip off anything prior to the first DIV, we don't want it.
448
  $action = $matches[0][$i] ;
449
  }
450
 
451
+ //.$html = str_replace($action, 'action="' . get_permalink(get_the_ID()) . '"', $html) ;
452
  $html = str_replace($action, 'action=""', $html) ;
453
  $action = preg_replace('/^action/i', 'value', $action) ;
454
 
464
 
465
  $wpgform_options = wpgform_get_plugin_options() ;
466
 
467
+ if (($wpgform_options['custom_css'] == 1) && !empty($wpgform_options['custom_css_styles']))
468
  $css = '<style>' . $wpgform_options['custom_css_styles'] . '</style>' ;
469
  else
470
  $css = '' ;
490
  if ($posted && is_null($action) && !is_null($alert))
491
  $js .= PHP_EOL . 'alert("' . $alert . '") ;' ;
492
 
493
+ // Load the confirmation URL via AJAX?
494
+ if ($posted && is_null($action) && !is_null($confirm) && $style === WPGFORM_CONFIRM_AJAX)
495
  $js .= PHP_EOL . '$("body").load("' . $confirm . '") ;' ;
496
 
497
+ // Load the confirmation URL via Redirect?
498
+ if ($posted && is_null($action) && !is_null($confirm) && $style === WPGFORM_CONFIRM_REDIRECT)
499
+ //printf('<h2>%s::%s</h2>', basename(__FILE__), __LINE__) ;
500
+ $js .= PHP_EOL . 'window.location.replace("' . $confirm . '") ;' ;
501
 
502
  $js .= '
503
  });
504
  </script>
505
  ' ;
506
 
 
507
  // Send email?
508
  if ($posted && is_null($action) && $email)
509
  {
 
510
  wpGForm::SendConfirmationEmail($wpgform_options['email_format']) ;
511
  }
 
 
 
 
512
 
513
+ // Check browser compatibility? The jQuery used by this plugin may
514
+ // not work correctly on old browsers or IE running in compatibility mode.
 
 
 
 
 
 
515
 
516
+ if ($wpgform_options['browser_check'] == 1)
517
+ {
518
+ require_once(ABSPATH . '/wp-admin/includes/dashboard.php') ;
519
+
520
+ // Let's check the browser version just in case ...
521
 
522
+ $response = wp_check_browser_version();
523
 
524
+ if ($response && $response['upgrade'])
525
+ {
526
+ if ($response['insecure'])
527
+ $css .= '<div class="gform-browser-warning"><h4>' .
528
+ __('Warning: You are using an insecure browser!') . '</h4></div>' ;
529
+ else
530
+ $css .= '<div class="gform-browser-warning"><h4>' .
531
+ __('Warning: Your browser is out of date! Please update now.') . '</h4></div>' ;
532
+ }
533
+ }
534
 
535
+ return $js . $css . $html ;
536
  }
537
+
538
  /**
539
  * WordPress Shortcode handler.
540
  *
542
  */
543
  function RenderGForm($atts) {
544
  $params = shortcode_atts(array(
545
+ 'form' => false, // Google Form URL
546
+ 'confirm' => false, // Custom confirmation page URL to redirect to
547
+ 'alert' => null, // Optional Alert Message
548
+ 'class' => 'gform', // Container element's custom class value
549
+ 'legal' => 'on', // Display Google Legal Stuff
550
+ 'br' => 'off', // Insert <br> tags between labels and inputs
551
+ 'suffix' => null, // Add suffix character(s) to all labels
552
+ 'prefix' => null, // Add suffix character(s) to all labels
553
+ 'readonly' => 'off', // Set all form elements to disabled
554
+ 'title' => 'on', // Remove the H1 element(s) from the Form
555
+ 'maph1h2' => 'off', // Map H1 element(s) on the form to H2 element(s)
556
+ 'email' => 'off', // Send an email confirmation to blog admin on submission
557
+ 'style' => WPGFORM_CONFIRM_REDIRECT // How to present the custom confirmation after submit
558
  ), $atts) ;
559
 
560
  return wpGForm::ConstructGForm($params) ;
568
  *
569
  * @param string $action - action to take, register or unregister
570
  */
571
+ function SendConfirmationEmail($mode = WPGFORM_EMAIL_FORMAT_HTML)
572
  {
573
  if ($mode == WPGFORM_EMAIL_FORMAT_HTML)
574
  {
637
 
638
  $subject = sprintf('Form Submission from %s', get_option('blogname')) ;
639
 
 
 
 
640
  $status = wp_mail($to, $subject, $message, $headers) ;
641
 
642
  return $status ;
wpgform-options.php CHANGED
@@ -301,12 +301,38 @@ function wpgform_settings_input()
301
  Send confirmation email (when used) in Plain Text format.</label>
302
  </fieldset></td>
303
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  <tr valign="top">
305
  <th scope="row"><label>Donation Request</label></th>
306
  <td><fieldset>
307
  <label for="gform_donation_message">
 
 
 
308
  <input name="wpgform_options[donation_message]" type="checkbox" id="gform_donation_message" value="1" <?php checked('1', $wpgform_options['donation_message']) ; ?> />
309
- Hide the request for donation at the top of this page. Donation request will remain on the <b>About</b> tab.</label>
 
 
 
 
 
 
310
  </fieldset></td>
311
  </tr>
312
  </table>
301
  Send confirmation email (when used) in Plain Text format.</label>
302
  </fieldset></td>
303
  </tr>
304
+ <tr valign="top">
305
+ <th scope="row"><label>Browser Check</label></th>
306
+ <td><fieldset>
307
+ <label for="gform_browser_check">
308
+ <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
309
+ <tr>
310
+ <td style="padding: 0px;">
311
+ <input name="wpgform_options[browser_check]" type="checkbox" id="gform_browser_check" value="1" <?php checked('1', $wpgform_options['browser_check']) ; ?> />
312
+ </td>
313
+ <td style="padding: 5px;">
314
+ Check browser compatibility? The WordPress Google Form plugin may not work as expected with older browser versions (e.g. IE6, IE7, etc.).
315
+ </td>
316
+ </tr>
317
+ </table>
318
+ </label>
319
+ </fieldset></td>
320
+ </tr>
321
  <tr valign="top">
322
  <th scope="row"><label>Donation Request</label></th>
323
  <td><fieldset>
324
  <label for="gform_donation_message">
325
+ <table style="padding: 0px;" border="0" cellpadding="0" cellspacing="0">
326
+ <tr>
327
+ <td style="padding: 0px;">
328
  <input name="wpgform_options[donation_message]" type="checkbox" id="gform_donation_message" value="1" <?php checked('1', $wpgform_options['donation_message']) ; ?> />
329
+ </td>
330
+ <td style="padding: 5px;">
331
+ Hide the request for donation at the top of this page.<br/>The donation request will remain on the <b>About</b> tab.
332
+ </td>
333
+ </tr>
334
+ </table>
335
+ </label>
336
  </fieldset></td>
337
  </tr>
338
  </table>